On Wed, Jan 31, 2018 at 09:26:35AM +1030, Dan Kortschak wrote:

> > > Does the order in which the options in the tag appear matter (e.g. 
> > > `json:"first_name,omitempty"` vs `json:"omitempty,first_name"`) ?
> > 
> > I'd say they should not as their purposes are orthogonal to each
> > other.
> It does matter, and omitempty must have a leading comma; the first
> comma separated term is the JSON field name. From the json docs:
> 
> ```
> The format string gives the name of the field, possibly followed by a
> comma-separated list of options. The name may be empty in order to
> specify options without overriding the default field name.

Thank you! I stand corrected.

I think that's what happens when you get certain knowledge deep under
your skin: sure I habitually used ",option" countless times and surely
knew that it's due to the name field having been skipped but that
knowledge was unconscious. ;-)

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to