aboutsummaryrefslogtreecommitdiff
path: root/src/encoding/json/decode.go
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2024-05-23 20:50:25 -0700
committerGopher Robot <gobot@golang.org>2024-07-24 00:40:06 +0000
commit8659ad972f0f1fb389397cb35f810d9ccb36539f (patch)
tree37f15d3541cff6cccb492e60bb5dedc470bbf975 /src/encoding/json/decode.go
parent72cc7699f856f4ff64420c91a54cb9eac2542384 (diff)
downloadgo-8659ad972f0f1fb389397cb35f810d9ccb36539f.tar.xz
encoding/json: rewrite interface{} to any
For #49884 Change-Id: I1623201c47c820a152773d2f43d0072a1466d3bf Reviewed-on: https://go-review.googlesource.com/c/go/+/588118 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Commit-Queue: Ian Lance Taylor <iant@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com> Reviewed-by: Joseph Tsai <joetsai@digital-static.net> Auto-Submit: Ian Lance Taylor <iant@google.com> Commit-Queue: Ian Lance Taylor <iant@golang.org> Auto-Submit: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/encoding/json/decode.go')
-rw-r--r--src/encoding/json/decode.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/encoding/json/decode.go b/src/encoding/json/decode.go
index f8205704e3..69a1013b85 100644
--- a/src/encoding/json/decode.go
+++ b/src/encoding/json/decode.go
@@ -53,8 +53,8 @@ import (
// - bool, for JSON booleans
// - float64, for JSON numbers
// - string, for JSON strings
-// - []interface{}, for JSON arrays
-// - map[string]interface{}, for JSON objects
+// - []any, for JSON arrays
+// - map[string]any, for JSON objects
// - nil for JSON null
//
// To unmarshal a JSON array into a slice, Unmarshal resets the slice length
@@ -466,7 +466,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 interface{}
+ // var v any
// v = &v
if v.Elem().Kind() == reflect.Interface && v.Elem().Elem() == v {
v = v.Elem()
@@ -1019,7 +1019,7 @@ func (d *decodeState) literalStore(item []byte, v reflect.Value, fromQuoted bool
// in an empty interface. They are not strictly necessary,
// but they avoid the weight of reflection in this common case.
-// valueInterface is like value but returns interface{}
+// valueInterface is like value but returns any.
func (d *decodeState) valueInterface() (val any) {
switch d.opcode {
default:
@@ -1036,7 +1036,7 @@ func (d *decodeState) valueInterface() (val any) {
return
}
-// arrayInterface is like array but returns []interface{}.
+// arrayInterface is like array but returns []any.
func (d *decodeState) arrayInterface() []any {
var v = make([]any, 0)
for {
@@ -1062,7 +1062,7 @@ func (d *decodeState) arrayInterface() []any {
return v
}
-// objectInterface is like object but returns map[string]interface{}.
+// objectInterface is like object but returns map[string]any.
func (d *decodeState) objectInterface() map[string]any {
m := make(map[string]any)
for {