bytes.Compare
with bytes.Equal
SCC-S1004 607 }
608
609 actual := p.Encode().Bytes() // disregard output
610 if bytes.Compare(expect, actual) != 0 { 611 t.Fatal("not matched")
612 }
613 }()
Prefer using bytes.Equal
for checking equality of two byte
slices instead of
bytes.Compare
.
Instead of using bytes.Compare
to check whether two byte
slices are equal,
the shorthand bytes.Equal
, created explicitly for checking equality, could
be used.
if bytes.Compare(x, y) == 0 {}
if bytes.Equal(x, y) {}