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
@@ -166,11 +166,11 @@ func TestParseUntypedBinaryRange(t *testing.T) {
|
||||
t.Errorf("%d. `%v`: expected result upper type %v, got %v", i, tt.src, string(tt.result.UpperType), string(r.UpperType))
|
||||
}
|
||||
|
||||
if bytes.Compare(r.Lower, tt.result.Lower) != 0 {
|
||||
if !bytes.Equal(r.Lower, tt.result.Lower) {
|
||||
t.Errorf("%d. `%v`: expected result lower %v, got %v", i, tt.src, tt.result.Lower, r.Lower)
|
||||
}
|
||||
|
||||
if bytes.Compare(r.Upper, tt.result.Upper) != 0 {
|
||||
if !bytes.Equal(r.Upper, tt.result.Upper) {
|
||||
t.Errorf("%d. `%v`: expected result upper %v, got %v", i, tt.src, tt.result.Upper, r.Upper)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user