2
0

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:
Dan McGee
2023-07-07 16:15:57 -05:00
committed by Jack Christensen
parent cd46cdd450
commit 0328d314ea
12 changed files with 19 additions and 19 deletions
+2 -2
View File
@@ -25,7 +25,7 @@ func isExpectedEqBytes(a any) func(any) bool {
return true
}
return bytes.Compare(ab, vb) == 0
return bytes.Equal(ab, vb)
}
}
@@ -64,7 +64,7 @@ func TestDriverBytes(t *testing.T) {
rowCount++
// At some point the buffer should be reused and change.
if bytes.Compare(argBuf, resultBuf) != 0 {
if !bytes.Equal(argBuf, resultBuf) {
detectedResultMutation = true
}