Skip to content

Commit

Permalink
chore: bytes.Equal instead bytes.Compare (#2485)
Browse files Browse the repository at this point in the history
Signed-off-by: guoguangwu <guoguangwu@magic-shield.com>
  • Loading branch information
testwill committed Jul 13, 2023
1 parent fd21bd2 commit fd35e17
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions consumer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1866,7 +1866,7 @@ func assertMessageKey(t *testing.T, msg *ConsumerMessage, expectedKey Encoder) {
t.Helper()

wantKey, _ := expectedKey.Encode()
if bytes.Compare(msg.Key, wantKey) != 0 {
if !bytes.Equal(msg.Key, wantKey) {
t.Fatalf("Incorrect key for message. expected=%s, actual=%s", expectedKey, msg.Key)
}
}
Expand All @@ -1875,7 +1875,7 @@ func assertMessageValue(t *testing.T, msg *ConsumerMessage, expectedValue Encode
t.Helper()

wantValue, _ := expectedValue.Encode()
if bytes.Compare(msg.Value, wantValue) != 0 {
if !bytes.Equal(msg.Value, wantValue) {
t.Fatalf("Incorrect value for message. expected=%s, actual=%s", expectedValue, msg.Key)
}
}
Expand Down

0 comments on commit fd35e17

Please sign in to comment.