8000 Allow omitting empty keys · Issue #59 · go-ini/ini · GitHub
[go: up one dir, main page]

Skip to content

Allow omitting empty keys #59

Closed
Closed

Description

@radeksimko

The default golang JSON (un)marshal implementation respects omitempty inside a field's tag which will effectively omit such field from the resulting JSON if it's not defined in a given struct.

Field int `json:"myName,omitempty"`

I was wondering if there's any interest in such feature for this library - i.e. support something like this:

type Profile struct {
    First  string `ini:"first"`
    Second string `ini:"second,omitempty"`
}

The current implementation doesn't interpret commas in any special way which results in the following output:

[my-section]
first            = custom-value
second,omitempty = 

The expected behaviour would be

[my-section]
first = custom-value

Is there any reason to support commas inside key names? 😺

Activity

  1. unknwon commented on Aug 3, 2016

    @unknwon
    Member

    Sounds good, feel free to send PR.

  2. radeksimko commented on Aug 3, 2016

    @radeksimko
    ContributorAuthor

    See #60

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

      0