From 64e7f66b26d7e5a9d4a003e7867a5dcf939bba6d Mon Sep 17 00:00:00 2001 From: Emmanuel T Odeke Date: Thu, 7 Nov 2024 17:40:08 -0800 Subject: encoding/json, text/template: use reflect.Value.Equal instead of == This change applies a fix for a reflect.Value incorrect comparison using "==" or reflect.DeepEqual. This change is a precursor to the change that'll bring in the static analyzer "reflectvaluecompare", by ensuring that all tests pass beforehand. Updates #43993 Change-Id: I6c47eb0a1de6353ac7495cb8cb49b318b7ebba56 Reviewed-on: https://go-review.googlesource.com/c/go/+/626116 LUCI-TryBot-Result: Go LUCI Reviewed-by: Ian Lance Taylor Auto-Submit: Ian Lance Taylor Run-TryBot: Emmanuel Odeke TryBot-Result: Gopher Robot Reviewed-by: David Chase --- src/encoding/json/decode.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/encoding/json') diff --git a/src/encoding/json/decode.go b/src/encoding/json/decode.go index 1a05ef59a2..98102291ab 100644 --- a/src/encoding/json/decode.go +++ b/src/encoding/json/decode.go @@ -472,7 +472,7 @@ func indirect(v reflect.Value, decodingNull bool) (Unmarshaler, encoding.TextUnm // Prevent infinite loop if v is an interface pointing to its own address: // var v any // v = &v - if v.Elem().Kind() == reflect.Interface && v.Elem().Elem() == v { + if v.Elem().Kind() == reflect.Interface && v.Elem().Elem().Equal(v) { v = v.Elem() break } -- cgit v1.3-5-g9baa