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 breaks Decode #89

Closed
chowey opened this issue Aug 3, 2015 · 1 comment
Closed

omitempty breaks Decode #89

chowey opened this issue Aug 3, 2015 · 1 comment

Comments

@chowey
Copy link

chowey commented Aug 3, 2015

With #81, toml supports the omitempty tag while encoding a struct. For example:

type S struct {
    V string `toml:"value,omitempty"`
}

will skip writing "V" during toml.Encode().

Unfortunately the reverse is not true. omitempty has no meaning for toml.Decode() and is treated as part of the field name. In the example above, toml.Decode() will attempt to decode the field named value,omitempty into "V" and will ignore the field named value.

@cespare
Copy link
Collaborator

cespare commented Feb 23, 2016

Fixed by #82.

@cespare cespare closed this as completed Feb 23, 2016
ebrady pushed a commit to dvln/toml that referenced this issue Oct 24, 2016
* Test with the latest releases.
* Allow tip to fail.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants