diff --git a/src/encoding/json/encode.go b/src/encoding/json/encode.go index 09ecc9093ea..e09d7403b90 100644 --- a/src/encoding/json/encode.go +++ b/src/encoding/json/encode.go @@ -384,7 +384,8 @@ var ( // newTypeEncoder constructs an encoderFunc for a type. // The returned encoder only checks CanAddr when allowAddr is true. -func newTypeEncoder(t reflect.Type, allowAddr bool) encoderFunc { // If we have a non-pointer value whose type implements +func newTypeEncoder(t reflect.Type, allowAddr bool) encoderFunc { + // If we have a non-pointer value whose type implements // Marshaler with a value receiver, then we're better off taking // the address of the value - otherwise we end up with an // allocation as we cast the value to an interface.