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

omitempty incorrectly looks at values behind pointers #371

Closed
joukewitteveen opened this issue Oct 23, 2022 · 1 comment · Fixed by #392
Closed

omitempty incorrectly looks at values behind pointers #371

joukewitteveen opened this issue Oct 23, 2022 · 1 comment · Fixed by #392
Labels

Comments

@joukewitteveen
Copy link

isEmpty is called on a fully dereferenced struct, but if the original field type of the struct was a pointer to a struct, then omitempty should be taken to mean "drop if nil, otherwise output". In other words: isEmpty on any pointer type should return true precisely when the pointer is nil. This is currently not what happens because the field value is fully dereferenced.

This is a leftover from #360. The issue is demonstrated by the failure in #370.

arp242 added a commit that referenced this issue Oct 24, 2022
@arp242
Copy link
Collaborator

arp242 commented Oct 24, 2022

I can confirm it broke in the v1.2.0 release; it works as expected in v1.1.0. It's probably d138d7a that introduced this; that changed it to always call eindirect.

Not sure yet when I'll look at this, but happy to review and accept patches in the meanwhile.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants