Skip to content

Should omitzero be used to default fields to optional when they have no explicit marker? #1306

@alvaroaleman

Description

@alvaroaleman

Pretty much title, by default we mark fields as optional if they have omitempty set and no explicit marker exists. It would be consistent to do the same for omitzero.

The counterargument on the other hand is that any sort of defaulting is a bit magic. I am not completely sure what is best here but have a slight tendency to make it consistent, so opening this for discussion.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions