go-json
go-json copied to clipboard
Fix ignoring `omitempty` tag when field of custom type with pointer receiver on MarshalJSON implementation (fixes #488)
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.