Skip to content

invalid-struct-tag

Validate struct tag syntax, duplicate keys, and standard options.

Updated View as Markdown

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

Default severity: error

Behavior

The rule validates quoted key-value syntax, duplicate keys, whitespace and quoting in common tag names, and JSON/XML options. Duplicate keys are reported consistently regardless of which packages the file imports.

Bad

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

Good

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

Type to search…

↑↓ navigate↵ selectEsc close