Use bytes.Equal rather than bytes.Compare ==/!= 0
As recommended by go-staticcheck, but also might be a bit more efficient for the compiler to implement, since we don't care about which slice of bytes is greater than the other one.
This commit is contained in:
committed by
Jack Christensen
parent
cd46cdd450
commit
0328d314ea
+1
-1
@@ -13,7 +13,7 @@ func isExpectedEqBits(a any) func(any) bool {
|
||||
return func(v any) bool {
|
||||
ab := a.(pgtype.Bits)
|
||||
vb := v.(pgtype.Bits)
|
||||
return bytes.Compare(ab.Bytes, vb.Bytes) == 0 && ab.Len == vb.Len && ab.Valid == vb.Valid
|
||||
return bytes.Equal(ab.Bytes, vb.Bytes) && ab.Len == vb.Len && ab.Valid == vb.Valid
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user