Skip to content
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

Fix ignoring omitempty tag when field of custom type with pointer receiver on MarshalJSON implementation (fixes #488) #489

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

GCrispino
Copy link

Fixes #488.

To do this I set fieldCode.isNilCheck to true in the case statement where isPtr && c.isPtrMarshalJSONType(fieldType): in Compiler's method structFieldCode.
To be honest I don't exactly know all the implications to this, but this didn't break any tests and made the new test I added for the issue pass, so maybe this is a valid fix.

Gabriel Crispino added 2 commits December 17, 2023 21:26
test: draft for omitempty on pointer receiver for MarshalJSON

test: move new test onto omitempty marshaling tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

omitempty tag is ignored when field's type has pointer receiver in MarshalJSON implementation
1 participant