Skip to content

Perhaps correlate optional with omitempty #1

@karalabe

Description

@karalabe

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions