We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
https://play.golang.org/p/6GgCp-aY4Y
The text was updated successfully, but these errors were encountered:
This is working as intended. You're telling it to turn &m into null, and it is, and then you're assigning to a nil map.
Unmarshal will return an error if you try to unmarshal an integer or boolean, but null and a JSON object can both unmarshal into a map.
Unmarshal
Sorry, something went wrong.
@bradfitz OK so I guess if that's the intended behavior, why I can still read from the map and it doesn't panic?
Because that's how the Go language works:
http://golang.org/ref/spec#Map_types
It says:
A nil map is equivalent to an empty map except that no elements may be added.
Oh okay good to know :) Thanks Brad.
On Friday, April 10, 2015, Brad Fitzpatrick notifications@github.com wrote:
Because that's how the Go language works: http://golang.org/ref/spec#Map_types It says A nil map is equivalent to an empty map except that no elements may be added.. — Reply to this email directly or view it on GitHub #10411 (comment).
It says A nil map is equivalent to an empty map except that no elements may be added..
— Reply to this email directly or view it on GitHub #10411 (comment).
No branches or pull requests
The text was updated successfully, but these errors were encountered: