mirror of
https://github.com/protocolbuffers/protobuf-go.git
synced 2025-01-30 03:32:49 +00:00
proto: use reflect.Ptr for backward compatibility
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 <dneil@google.com> Reviewed-by: Joseph Tsai <joetsai@digital-static.net> Reviewed-by: Lasse Folger <lassefolger@google.com>
This commit is contained in:
parent
380c339ec1
commit
fc44d00d5a
@ -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
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user