Closed
Description
1625da2 (issue: #14493, CL: http://golang.org/cl/21811) caused a regression where the a nil RawMessage no longer gets marshaled as "null".
Consider the following:
var nilJSON json.RawMessage
b, err := json.Marshal(nilJSON)
fmt.Printf("%q\t%v\n", b, err)
b, err = json.Marshal(&nilJSON)
fmt.Printf("%q\t%v\n", b, err)
On Go 1.7, this prints:
"null" <nil>
"" json: error calling MarshalJSON for type *json.RawMessage: unexpected end of JSON input
On 1625da2, this prints:
"" json: error calling MarshalJSON for type json.RawMessage: unexpected end of JSON input
"" json: error calling MarshalJSON for type *json.RawMessage: unexpected end of JSON input
In light of the change to address #14493, I expect this to print:
"null" <nil>
"null" <nil>
Does anyone object if I make this change?