Skip to content

Add support for omitempty tag option#60

Merged
unknwon merged 1 commit into
masterfrom
unknown repository
Aug 5, 2016
Merged

Add support for omitempty tag option#60
unknwon merged 1 commit into
masterfrom
unknown repository

Conversation

@radeksimko

Copy link
Copy Markdown
Contributor

Closes #59

The isEmptyValue is shamelessly stolen from https://github.com/golang/go/tree/master/src/encoding/json , I just added support for time.Time. 😉

Comment thread struct.go Outdated
return fmt.Errorf("Expected max. 2 comma-separated values in a tag, %d given", len(opts))
}

if opts[0] == "-" {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If tag is -, then should get out of loop directly, so we need if tag == "-" {, then do the omitempty check.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR updated.

@unknwon

unknwon commented Aug 5, 2016

Copy link
Copy Markdown
Member

Thanks!

@unknwon unknwon merged commit 8e15fc6 into go-ini:master Aug 5, 2016
unknwon added a commit that referenced this pull request Aug 5, 2016
@radeksimko radeksimko deleted the f-omitempty branch August 6, 2016 20:57
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

Successfully merging this pull request may close these issues.

2 participants