go-json icon indicating copy to clipboard operation
go-json copied to clipboard

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

Open GCrispino opened this issue 1 year ago • 0 comments

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.

GCrispino avatar Dec 18 '23 00:12 GCrispino