diff --git a/proto/size2_test.go b/proto/size2_test.go index 7846b06176..0b8eb85cf2 100644 --- a/proto/size2_test.go +++ b/proto/size2_test.go @@ -32,6 +32,7 @@ package proto import ( + "math" "testing" ) @@ -51,8 +52,8 @@ func TestVarintSize(t *testing.T) { {128, 2}, {16383, 2}, {16384, 3}, - {1<<63 - 1, 9}, - {1 << 63, 10}, + {math.MaxInt64, 9}, + {math.MaxInt64 + 1, 10}, } for _, tc := range testCases { size := SizeVarint(tc.n) diff --git a/proto/table_marshal.go b/proto/table_marshal.go index ba58c49a43..9b1538d055 100644 --- a/proto/table_marshal.go +++ b/proto/table_marshal.go @@ -491,7 +491,7 @@ func (fi *marshalFieldInfo) computeMarshalFieldInfo(f *reflect.StructField) { func (fi *marshalFieldInfo) computeOneofFieldInfo(f *reflect.StructField, oneofImplementers []interface{}) { fi.field = toField(f) - fi.wiretag = 1<<31 - 1 // Use a large tag number, make oneofs sorted at the end. This tag will not appear on the wire. + fi.wiretag = math.MaxInt32 // Use a large tag number, make oneofs sorted at the end. This tag will not appear on the wire. fi.isPointer = true fi.sizer, fi.marshaler = makeOneOfMarshaler(fi, f) fi.oneofElems = make(map[reflect.Type]*marshalElemInfo)