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
I expected go vet to warn me about the undecodable parts of the struct, with something like "encoding/json does not support dot-separated paths"
What did you see instead?
go vet did not print any output and had a zero exit value, indicating that there are no problems with the code.
The text was updated successfully, but these errors were encountered:
josharian
changed the title
cmd/vet should warn about malformed struct tags for JSON decoding
cmd/vet: warn about more malformed JSON struct tags
Feb 13, 2020
Seems reasonable. Should fit nicely into the existing vet struct tags check. Should be pretty straightforward to implement for anyone wanting to try their hand on vet.
Change https://golang.org/cl/236522 mentions this issue: analysis/passes/stucttag: error on . field accessor in JSON tag
dmitshur
added
NeedsFix
The path to resolution is known, but the work has not been done.
and removed
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
labels
May 19, 2022
I don't think this is something that can be flagged, {"fnord.foo": 1} is a valid json object that is supported by the current syntax https://go.dev/play/p/faEAfGx8uzE
I tend to agree with @seankhliao, and we likely can't change the existing behavior either. Also note that vet has a frequency criteria for its checks, and I have never encountered this kind of mistake myself.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes, the problem appears with 1.13.8 as well.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I ran
go vet
on the following code:What did you expect to see?
I expected
go vet
to warn me about the undecodable parts of the struct, with something like "encoding/json
does not support dot-separated paths"What did you see instead?
go vet
did not print any output and had a zero exit value, indicating that there are no problems with the code.The text was updated successfully, but these errors were encountered: