Skip to content

Commit 00da85b

Browse files
authored
Fix 32-bit overflows of math.MaxInt64 constant (#25)
math.MaxInt64 is an untyped int constant, the use of which will cause build failures on 32-bit archs if not explicitly typecast to int64. Signed-off-by: Daniel Swarbrick <daniel.swarbrick@gmail.com>
1 parent 01d8b36 commit 00da85b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

memlimit/memlimit_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ func TestSetGoMemLimitWithOpts_WithRefreshInterval(t *testing.T) {
267267

268268
curr = debug.SetMemoryLimit(-1)
269269
if curr != math.MaxInt64 {
270-
t.Errorf("debug.SetMemoryLimit(-1) got = %v, want %v", curr, math.MaxInt64)
270+
t.Errorf("debug.SetMemoryLimit(-1) got = %v, want %v", curr, int64(math.MaxInt64))
271271
}
272272

273273
// 3. adjust limit
@@ -276,7 +276,7 @@ func TestSetGoMemLimitWithOpts_WithRefreshInterval(t *testing.T) {
276276

277277
curr = debug.SetMemoryLimit(-1)
278278
if curr != math.MaxInt64-1024 {
279-
t.Errorf("debug.SetMemoryLimit(-1) got = %v, want %v", curr, math.MaxInt64-1024)
279+
t.Errorf("debug.SetMemoryLimit(-1) got = %v, want %v", curr, int64(math.MaxInt64)-1024)
280280
}
281281

282282
// 4. no limit again
@@ -285,7 +285,7 @@ func TestSetGoMemLimitWithOpts_WithRefreshInterval(t *testing.T) {
285285

286286
curr = debug.SetMemoryLimit(-1)
287287
if curr != math.MaxInt64 {
288-
t.Errorf("debug.SetMemoryLimit(-1) got = %v, want %v", curr, math.MaxInt64)
288+
t.Errorf("debug.SetMemoryLimit(-1) got = %v, want %v", curr, int64(math.MaxInt64))
289289
}
290290

291291
// 5. new limit

0 commit comments

Comments
 (0)