0
0
Fork 0
mirror of https://github.com/go-gitea/gitea synced 2024-12-26 14:44:31 +01:00

Fix integer constant overflows in tests (#4616)

* Use integer limit value [1] instead of hard-coded magic constant for
  NonexistentID.

* Explicitly use int64 in order to avoid the following errors on 32 bit
  architectures:

  # code.gitea.io/gitea/integrations
  ./api_admin_test.go:50:34: constant 9223372036854775807 overflows int
  ./api_token_test.go:47:34: constant 9223372036854775807 overflows int
  [...]
  # code.gitea.io/gitea/models
  ./action_test.go:179:15: constant 9223372036854775807 overflows int

[1] https://golang.org/pkg/math/#pkg-constants

Signed-off-by: Dennis Menschel <menschel-d@posteo.de>
This commit is contained in:
Dennis Menschel 2018-08-06 13:52:53 +02:00 committed by Lauris BH
parent 9ea327f1f7
commit 9c0a374f3f

View file

@ -7,6 +7,7 @@ package models
import ( import (
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"math"
"net/url" "net/url"
"os" "os"
"path/filepath" "path/filepath"
@ -23,7 +24,7 @@ import (
) )
// NonexistentID an ID that will never exist // NonexistentID an ID that will never exist
const NonexistentID = 9223372036854775807 const NonexistentID = int64(math.MaxInt64)
// giteaRoot a path to the gitea root // giteaRoot a path to the gitea root
var giteaRoot string var giteaRoot string