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
+2
-2
@@ -1518,7 +1518,7 @@ func TestConnSimpleProtocol(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if bytes.Compare(actual, expected) != 0 {
|
||||
if !bytes.Equal(actual, expected) {
|
||||
t.Errorf("expected %v got %v", expected, actual)
|
||||
}
|
||||
}
|
||||
@@ -1825,7 +1825,7 @@ func TestConnSimpleProtocol(t *testing.T) {
|
||||
if expectedBool != actualBool {
|
||||
t.Errorf("expected %v got %v", expectedBool, actualBool)
|
||||
}
|
||||
if bytes.Compare(expectedBytes, actualBytes) != 0 {
|
||||
if !bytes.Equal(expectedBytes, actualBytes) {
|
||||
t.Errorf("expected %v got %v", expectedBytes, actualBytes)
|
||||
}
|
||||
if expectedString != actualString {
|
||||
|
||||
Reference in New Issue
Block a user