Skip to content

Commit 940fa30

Browse files
committed
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 <[email protected]>
1 parent 9c354a5 commit 940fa30

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

models/unit_tests.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ package models
77
import (
88
"fmt"
99
"io/ioutil"
10+
"math"
1011
"net/url"
1112
"os"
1213
"path/filepath"
@@ -23,7 +24,7 @@ import (
2324
)
2425

2526
// NonexistentID an ID that will never exist
26-
const NonexistentID = 9223372036854775807
27+
const NonexistentID = int64(math.MaxInt64)
2728

2829
// giteaRoot a path to the gitea root
2930
var giteaRoot string

0 commit comments

Comments
 (0)