diff --git a/src/math/big/int_test.go b/src/math/big/int_test.go index 88c8c2bb641..97874626f33 100644 --- a/src/math/big/int_test.go +++ b/src/math/big/int_test.go @@ -387,6 +387,11 @@ func TestSetBytes(t *testing.T) { } func checkBytes(b []byte) bool { + // trim leading zero bytes since Bytes() won't return them + // (was issue 12231) + for len(b) > 0 && b[0] == 0 { + b = b[1:] + } b2 := new(Int).SetBytes(b).Bytes() return bytes.Equal(b, b2) }