Skip to content

omitempty unexpectedly omits a member when the member is a struct with a non-zero unexported member #378

@hajimehoshi

Description

@hajimehoshi

Issue tracker is used for reporting bugs and discussing new features. Please use
Discord or stackoverflow for supporting
issues.

Here is the minimum test case: https://go.dev/play/p/3FvUksIAooa

Expected Behavior

Nothing is printed

Current Behavior

got: "", want: "str"

Possible Solution

omitempty should not ignore a struct value which is with a non-zero unexported member. This should be possible by comparing with a zero value.

Steps to Reproduce

Context (Environment)

Detailed Description

Possible Implementation

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