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:
Koichi Shiraishi 2022-06-16 00:26:01 +09:00 committed by Lasse Folger
parent 380c339ec1
commit fc44d00d5a

View File

@ -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
}