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

Perhaps correlate optional with omitempty #1

Open
karalabe opened this issue Mar 27, 2017 · 0 comments
Open

Perhaps correlate optional with omitempty #1

karalabe opened this issue Mar 27, 2017 · 0 comments

Comments

@karalabe
Copy link

karalabe commented Mar 27, 2017

Currently there seems to be no correlation between this package's optional tag and for example the json omitempty tag. I.e. if I specify a field in this package to be optional, I'd expect it to automatically add omitempty to json fields and not just blindly copy the original tags. This would be beneficial because it would avoid needing to specify both optional and omitempty.

Now I do know that optional is used during unmarshaling and omitempty during marshaling, so there is a case for the current behavior too. Just figured I'd raise this since I slipped up on this at my first go.

@karalabe karalabe changed the title First! Perhaps correlate optional with omitempty Mar 27, 2017
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

No branches or pull requests

1 participant