BuildAnalyzers builds the analyzers for the StructFieldPlugin.
()
| 80 | |
| 81 | // BuildAnalyzers builds the analyzers for the StructFieldPlugin. |
| 82 | func (f *StructFieldPlugin) BuildAnalyzers() ([]*analysis.Analyzer, error) { |
| 83 | return []*analysis.Analyzer{ |
| 84 | { |
| 85 | Name: "structfield", |
| 86 | Doc: `Reports mismatches between Go field and JSON or URL tag names and types. |
| 87 | Note that the JSON or URL tag name is the source-of-truth and the Go field name needs to match it. |
| 88 | If the "json" tag contains "omitempty", then the Go field must be a reference type. |
| 89 | If the "url" tag contains "omitempty", then the Go field must be a value type (unless it is a timestamp).`, |
| 90 | Run: func(pass *analysis.Pass) (any, error) { |
| 91 | return run(pass, f.allowedTagNames, f.allowedTagTypes) |
| 92 | }, |
| 93 | }, |
| 94 | }, nil |
| 95 | } |
| 96 | |
| 97 | // GetLoadMode returns the load mode for the StructFieldPlugin. |
| 98 | func (f *StructFieldPlugin) GetLoadMode() string { |