From 940fa30da74125c6824025a69395759615b8de3a Mon Sep 17 00:00:00 2001 From: Dennis Menschel Date: Sat, 4 Aug 2018 14:36:22 +0200 Subject: [PATCH] Fix integer constant overflows in tests * 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 --- models/unit_tests.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/models/unit_tests.go b/models/unit_tests.go index 9013fb9871677..2b7f0d0151cb7 100644 --- a/models/unit_tests.go +++ b/models/unit_tests.go @@ -7,6 +7,7 @@ package models import ( "fmt" "io/ioutil" + "math" "net/url" "os" "path/filepath" @@ -23,7 +24,7 @@ import ( ) // NonexistentID an ID that will never exist -const NonexistentID = 9223372036854775807 +const NonexistentID = int64(math.MaxInt64) // giteaRoot a path to the gitea root var giteaRoot string