-
-
Notifications
You must be signed in to change notification settings - Fork 531
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
Labels
Comments
arp242
added a commit
that referenced
this issue
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 Not sure yet when I'll look at this, but happy to review and accept patches in the meanwhile. |
cespare
added a commit
that referenced
this issue
May 23, 2023
cespare
added a commit
that referenced
this issue
May 23, 2023
arp242
pushed a commit
that referenced
this issue
May 30, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The text was updated successfully, but these errors were encountered: