You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Expected behavior
At the most basic I would expect a struct without any exported fields, but with a MarshalText implementation, to always be marshalled, just to be on the safe side.
Ideally there should be a way to instruct a custom zero behaviour, e.g. netip.Ip already exposes an IsZero() bool call, so possibly this could be used.
Versions
go-toml: 2.2.2
go: 1.22.4
operating system: Linux
The text was updated successfully, but these errors were encountered:
I think you're right that at the very least, an type implementing MarshalText should always be marshaled, even with omitempty, as the goal is to mimic the behavior of encoding/json.
For skipping a value completely, I think we providing a toml.Marshaler interface to implement would be the right way to go.
Describe the bug
Marshalling netip.Addr with omitempty struct tag always returns empty, because the type doesn't have any exported fields.
To Reproduce
Minimal example:
Expected behavior
At the most basic I would expect a struct without any exported fields, but with a MarshalText implementation, to always be marshalled, just to be on the safe side.
Ideally there should be a way to instruct a custom zero behaviour, e.g. netip.Ip already exposes an
IsZero() bool
call, so possibly this could be used.Versions
The text was updated successfully, but these errors were encountered: