-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Closed
Labels
FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.
Milestone
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?
Metadata
Metadata
Assignees
Labels
FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.