Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore struct tag options #20

Merged
merged 1 commit into from Mar 7, 2019

Conversation

Projects
None yet
2 participants
@Carpetsmoker
Copy link
Contributor

Carpetsmoker commented Mar 7, 2019

I have a simple struct:

type Test struct
	Name     string `json:"name"`
	Website  string `json:"website,omitempty"`
}

Since the names for json and the HTTP form are the same I thought I'd
be clever and use TagName: "json" with formam. Unfortunately that
doesn't work as the options (everything after the comma, ",omitempty")
aren't ignored.

This patch fixes that.

Ignore struct tag options
I have a simple struct:

	type Test struct
		Name     string `json:"name"`
		Website  string `json:"website,omitempty"`
	}

Since the names for `json` and the HTTP form are the same I thought I'd
be clever and use `TagName: "json"` with formam. Unfortunately that
doesn't work as the options (everything after the comma, ",omitempty")
aren't ignored.

This patch fixes that.

@emilgpa emilgpa merged commit 2d02e6b into monoculum:master Mar 7, 2019

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@emilgpa

This comment has been minimized.

Copy link
Contributor

emilgpa commented Mar 7, 2019

thanks you!

@Carpetsmoker Carpetsmoker deleted the Carpetsmoker:tagopt branch Mar 7, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.