mirror of
https://github.com/golang/go.git
synced 2025-11-09 21:21:03 +00:00
encoding/json: call reflect.TypeOf with nil pointers rather than allocating
Updates #26775 Change-Id: I83c9eeda59769d2f35e0cc98f3a8579861d5978b Reviewed-on: https://go-review.googlesource.com/119715 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
3333b6407d
commit
dc272a4393
2 changed files with 3 additions and 3 deletions
|
|
@ -381,8 +381,8 @@ func typeEncoder(t reflect.Type) encoderFunc {
|
|||
}
|
||||
|
||||
var (
|
||||
marshalerType = reflect.TypeOf(new(Marshaler)).Elem()
|
||||
textMarshalerType = reflect.TypeOf(new(encoding.TextMarshaler)).Elem()
|
||||
marshalerType = reflect.TypeOf((*Marshaler)(nil)).Elem()
|
||||
textMarshalerType = reflect.TypeOf((*encoding.TextMarshaler)(nil)).Elem()
|
||||
)
|
||||
|
||||
// newTypeEncoder constructs an encoderFunc for a type.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue