-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
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
Support nil interfaces #19
Comments
@wade-tattersall |
Sorry, I messed up somehow - I think I must have forgotten to save before running the repro after I tried simplifying it. After a bit of digging, I was able to work out what does trigger it: https://play.golang.org/p/7wCzhabD1dF. That is, it fails for the relatively trivial case of There's a subtlety there that confuses me - |
I don't have much time at the moment - if you provide a PR though (with test cases please), I'll do my best to review it! |
Hi @mweibel, I've created a PR for this issue. Could you help review it? Thank you a lot. |
fixed by #26 |
Marshal currently triggers a panic if it runs into any nil pointers.
I think such values should be stored in the resulting map as nils. This would be consistent with the json package, allowing the resulting map to be passed to json.Marshal and get the same result as if the struct itself were passed directly to json.Marshal.
Example code:
The text was updated successfully, but these errors were encountered: