Skip to content

Commit

Permalink
proto: use reflect.Ptr for backward compatibility
Browse files Browse the repository at this point in the history
reflect.Pointer introduced on go1.18. Support 1.17 and earlier.

Change-Id: I62dcdb580a7976068e86df432bc44ee21c2cda81
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/412354
Reviewed-by: Damien Neil <[email protected]>
Reviewed-by: Joseph Tsai <[email protected]>
Reviewed-by: Lasse Folger <[email protected]>
  • Loading branch information
zchee authored and lfolger committed Jun 17, 2022
1 parent 380c339 commit fc44d00
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion proto/equal.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func Equal(x, y Message) bool {
if x == nil || y == nil {
return x == nil && y == nil
}
if reflect.TypeOf(x).Kind() == reflect.Pointer && x == y {
if reflect.TypeOf(x).Kind() == reflect.Ptr && x == y {
// Avoid an expensive comparison if both inputs are identical pointers.
return true
}
Expand Down

0 comments on commit fc44d00

Please sign in to comment.