Skip to content

invalid-struct-tag

Detect malformed struct tags before reflection or encoding packages silently ignore them.

Default severity: error

The rule validates quoted key-value syntax, duplicate keys, whitespace and quoting in common tag names, and JSON/XML options. Repeated choice, optional-value, and default keys are accepted in files importing github.com/jessevdk/go-flags, whose tag format intentionally uses them.

type User struct {
Name string `json:name`
}
type User struct {
Name string `json:"name"`
}