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.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
By convention, tag strings are a concatenation of optionally space-separated key:"value" pairs. Each key is a non-empty string consisting of non-control characters other than space (U+0020 ' '), quote (U+0022 '"'), and colon (U+003A ':'). Each value is quoted using U+0022 '"' characters and Go string literal syntax.
This doesn't seem ideal and violates the principle of least surprise. Is there a reason you feel strongly about not supporting whitespace there?
If you feel strongly there should not be spaces in tag string values, a space in there should be a syntax error, or at the very least a linter error. Again, happy to write a patch, just wanted to understand your reasoning better first.
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?1.7.4
What operating system and processor architecture are you using (
go env
)?darwin/amd64
What did you do?
https://play.golang.org/p/vhIPYQjX8_
What did you expect to see?
type A struct { B *int `json:"b, omitempty"` }
should serialize to{}
What did you see instead?
type A struct { B *int `json:"b, omitempty"` }
serializes to{"b":null}
Happy to submit a patch to address this, just wanted to know if there wasn't a specific unstated reason why this is the way it is.
The text was updated successfully, but these errors were encountered: