analysis/facts/directives/directives.go
raw| 1 | package directives |
| 2 | |
| 3 | import ( |
| 4 | "reflect" |
| 5 | |
| 6 | "golang.org/x/tools/go/analysis" |
| 7 | "honnef.co/go/tools/analysis/lint" |
| 8 | ) |
| 9 | |
| 10 | func directives(pass *analysis.Pass) (any, error) { |
| 11 | return lint.ParseDirectives(pass.Files, pass.Fset), nil |
| 12 | } |
| 13 | |
| 14 | var Analyzer = &analysis.Analyzer{ |
| 15 | Name: "directives", |
| 16 | Doc: "extracts linter directives", |
| 17 | Run: directives, |
| 18 | RunDespiteErrors: true, |
| 19 | ResultType: reflect.TypeFor[[]lint.Directive](), |
| 20 | } |