should use !bytes.Equal(expect, actual) instead
607 }
608
609 actual := p.Encode().Bytes() // disregard output
610 if bytes.Compare(expect, actual) != 0 { 611 t.Fatal("not matched")
612 }
613 }()
Description
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.
Bad practice
if bytes.Compare(x, y) == 0 {}
Recommended
if bytes.Equal(x, y) {}