From fc44d00d5a99973a6deb0863d6aaa7446c016066 Mon Sep 17 00:00:00 2001 From: Koichi Shiraishi Date: Thu, 16 Jun 2022 00:26:01 +0900 Subject: [PATCH] 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 Reviewed-by: Joseph Tsai Reviewed-by: Lasse Folger --- proto/equal.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto/equal.go b/proto/equal.go index 49e16ba75..67948dd1d 100644 --- a/proto/equal.go +++ b/proto/equal.go @@ -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 }