From 1625da24106b610f89ff7a67a11581df95f8e234 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Sun, 10 Apr 2016 10:16:41 -0700 Subject: encoding/json: marshal the RawMessage value type the same as its pointer type Fixes #14493 Updates #6458 (changes its behavior) Change-Id: I851a8113fd312dae3384e989ec2b70949dc22838 Reviewed-on: https://go-review.googlesource.com/21811 Run-TryBot: Brad Fitzpatrick TryBot-Result: Gobot Gobot Reviewed-by: Quentin Smith --- src/encoding/json/stream.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/encoding/json/stream.go') diff --git a/src/encoding/json/stream.go b/src/encoding/json/stream.go index 87f0e57c6c..4c350fdd5e 100644 --- a/src/encoding/json/stream.go +++ b/src/encoding/json/stream.go @@ -246,9 +246,9 @@ func (enc *Encoder) SetEscapeHTML(on bool) { // be used to delay JSON decoding or precompute a JSON encoding. type RawMessage []byte -// MarshalJSON returns *m as the JSON encoding of m. -func (m *RawMessage) MarshalJSON() ([]byte, error) { - return *m, nil +// MarshalJSON returns m as the JSON encoding of m. +func (m RawMessage) MarshalJSON() ([]byte, error) { + return m, nil } // UnmarshalJSON sets *m to a copy of data. -- cgit v1.3-5-g45d5