aboutsummaryrefslogtreecommitdiff
path: root/src/encoding/json/decode.go
diff options
context:
space:
mode:
authorJoe Tsai <joetsai@digital-static.net>2025-06-21 21:01:32 -0700
committerJoseph Tsai <joetsai@digital-static.net>2025-09-09 17:22:28 -0700
commite6605a1bcc56523c0168caf765399dede7d3d1e4 (patch)
treee0d0e0b917a017db6692dbabe5f3a67eff2a0689 /src/encoding/json/decode.go
parent4c20f7f15a9a8eed50d8cbb8be8f74d449093a5c (diff)
downloadgo-e6605a1bcc56523c0168caf765399dede7d3d1e4.tar.xz
encoding/json: use reflect.TypeAssert
Updates #62121 Change-Id: Ic3c4fe84a5dacfd8270aba0d5dd59f83f0a9030f Reviewed-on: https://go-review.googlesource.com/c/go/+/701955 Reviewed-by: Mark Freeman <markfreeman@google.com> Reviewed-by: Damien Neil <dneil@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'src/encoding/json/decode.go')
-rw-r--r--src/encoding/json/decode.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/encoding/json/decode.go b/src/encoding/json/decode.go
index fc29296c0f..46f9ed2da9 100644
--- a/src/encoding/json/decode.go
+++ b/src/encoding/json/decode.go
@@ -482,11 +482,11 @@ func indirect(v reflect.Value, decodingNull bool) (Unmarshaler, encoding.TextUnm
v.Set(reflect.New(v.Type().Elem()))
}
if v.Type().NumMethod() > 0 && v.CanInterface() {
- if u, ok := v.Interface().(Unmarshaler); ok {
+ if u, ok := reflect.TypeAssert[Unmarshaler](v); ok {
return u, nil, reflect.Value{}
}
if !decodingNull {
- if u, ok := v.Interface().(encoding.TextUnmarshaler); ok {
+ if u, ok := reflect.TypeAssert[encoding.TextUnmarshaler](v); ok {
return nil, u, reflect.Value{}
}
}