Skip to content

Commit

Permalink
Replace bytes.Compare with bytes.Equal
Browse files Browse the repository at this point in the history
  • Loading branch information
horpto authored and jackc committed Jul 31, 2023
1 parent 0458fa6 commit a2afee3
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion enum_type_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ func TestEnumTypeAssignTo(t *testing.T) {
err = enumType.AssignTo(tt.dst)
require.NoError(t, err, "%d", i)

if bytes.Compare(*tt.dst, tt.expected) != 0 {
if !bytes.Equal(*tt.dst, tt.expected) {
t.Errorf("%d: expected %v to assign %v, but result was %v", i, tt.src, tt.expected, tt.dst)
}
}
Expand Down
2 changes: 1 addition & 1 deletion ext/gofrs-uuid/uuid_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func TestUUIDAssignTo(t *testing.T) {
t.Error(err)
}

if bytes.Compare(dst, expected) != 0 {
if !bytes.Equal(dst, expected) {
t.Errorf("expected %v to assign %v, but result was %v", src, expected, dst)
}
}
Expand Down
2 changes: 1 addition & 1 deletion json_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func TestJSONAssignTo(t *testing.T) {
t.Errorf("%d: %v", i, err)
}

if bytes.Compare(tt.expected, *tt.dst) != 0 {
if !bytes.Equal(tt.expected, *tt.dst) {
t.Errorf("%d: expected %v to assign %v, but result was %v", i, tt.src, tt.expected, *tt.dst)
}
}
Expand Down
2 changes: 1 addition & 1 deletion jsonb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func TestJSONBAssignTo(t *testing.T) {
t.Errorf("%d: %v", i, err)
}

if bytes.Compare(tt.expected, *tt.dst) != 0 {
if !bytes.Equal(tt.expected, *tt.dst) {
t.Errorf("%d: expected %v to assign %v, but result was %v", i, tt.src, tt.expected, *tt.dst)
}
}
Expand Down
2 changes: 1 addition & 1 deletion macaddr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func TestMacaddrAssignTo(t *testing.T) {
t.Error(err)
}

if bytes.Compare([]byte(dst), []byte(expected)) != 0 {
if !bytes.Equal([]byte(dst), []byte(expected)) {
t.Errorf("expected %v to assign %v, but result was %v", src, expected, dst)
}
}
Expand Down
2 changes: 1 addition & 1 deletion point.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func (dst *Point) Set(src interface{}) error {
}

func parsePoint(src []byte) (*Point, error) {
if src == nil || bytes.Compare(src, []byte("null")) == 0 {
if src == nil || bytes.Equal(src, []byte("null")) {
return &Point{Status: Null}, nil
}

Expand Down
4 changes: 2 additions & 2 deletions range_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand Down
2 changes: 1 addition & 1 deletion text_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func TestTextAssignTo(t *testing.T) {
t.Errorf("%d: %v", i, err)
}

if bytes.Compare(*tt.dst, tt.expected) != 0 {
if !bytes.Equal(*tt.dst, tt.expected) {
t.Errorf("%d: expected %v to assign %v, but result was %v", i, tt.src, tt.expected, tt.dst)
}
}
Expand Down
2 changes: 1 addition & 1 deletion uuid.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ func (src UUID) MarshalJSON() ([]byte, error) {
}

func (dst *UUID) UnmarshalJSON(src []byte) error {
if bytes.Compare(src, []byte("null")) == 0 {
if bytes.Equal(src, []byte("null")) {
return dst.Set(nil)
}
if len(src) != 38 {
Expand Down
2 changes: 1 addition & 1 deletion uuid_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func TestUUIDAssignTo(t *testing.T) {
t.Error(err)
}

if bytes.Compare(dst, expected) != 0 {
if !bytes.Equal(dst, expected) {
t.Errorf("expected %v to assign %v, but result was %v", src, expected, dst)
}
}
Expand Down

0 comments on commit a2afee3

Please sign in to comment.