Skip to content

Commit 9ede1e6

Browse files
json: use reflect.PointerTo (avoid deprecated naming)
1 parent 7a0606c commit 9ede1e6

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

json/codec.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ func constructCodec(t reflect.Type, seen map[reflect.Type]*structType, canAddr b
205205
c = constructUnsupportedTypeCodec(t)
206206
}
207207

208-
p := reflect.PtrTo(t)
208+
p := reflect.PointerTo(t)
209209

210210
if canAddr {
211211
switch {
@@ -291,7 +291,7 @@ func constructSliceCodec(t reflect.Type, seen map[reflect.Type]*structType) code
291291
// Go 1.7+ behavior: slices of byte types (and aliases) may override the
292292
// default encoding and decoding behaviors by implementing marshaler and
293293
// unmarshaler interfaces.
294-
p := reflect.PtrTo(e)
294+
p := reflect.PointerTo(e)
295295
c := codec{}
296296

297297
switch {
@@ -391,7 +391,7 @@ func constructMapCodec(t reflect.Type, seen map[reflect.Type]*structType) codec
391391
kc := codec{}
392392
vc := constructCodec(v, seen, false)
393393

394-
if k.Implements(textMarshalerType) || reflect.PtrTo(k).Implements(textUnmarshalerType) {
394+
if k.Implements(textMarshalerType) || reflect.PointerTo(k).Implements(textUnmarshalerType) {
395395
kc.encode = constructTextMarshalerEncodeFunc(k, false)
396396
kc.decode = constructTextUnmarshalerDecodeFunc(k, true)
397397

@@ -1095,10 +1095,10 @@ var (
10951095
timeType = reflect.TypeOf(time.Time{})
10961096
rawMessageType = reflect.TypeOf(RawMessage(nil))
10971097

1098-
numberPtrType = reflect.PtrTo(numberType)
1099-
durationPtrType = reflect.PtrTo(durationType)
1100-
timePtrType = reflect.PtrTo(timeType)
1101-
rawMessagePtrType = reflect.PtrTo(rawMessageType)
1098+
numberPtrType = reflect.PointerTo(numberType)
1099+
durationPtrType = reflect.PointerTo(durationType)
1100+
timePtrType = reflect.PointerTo(timeType)
1101+
rawMessagePtrType = reflect.PointerTo(rawMessageType)
11021102

11031103
sliceInterfaceType = reflect.TypeOf(([]any)(nil))
11041104
sliceStringType = reflect.TypeOf(([]any)(nil))

0 commit comments

Comments
 (0)