Skip to content

Commit 014db21

Browse files
authored
analyzer: set diagnostics category (#228)
This allows wrapping errcheck.Analyzer with nolint.Wrap to silence diagnostics with //nolint:errcheck comments. Link: https://github.com/kyoh86/nolint Signed-off-by: Robin Jarry <robin@jarry.cc>
1 parent d116ada commit 014db21

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

errcheck/analyzer.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ func init() {
3131
}
3232

3333
func runAnalyzer(pass *analysis.Pass) (interface{}, error) {
34-
3534
exclude := map[string]bool{}
3635
if !argExcludeOnly {
3736
for _, name := range DefaultExcludedSymbols {
@@ -65,8 +64,9 @@ func runAnalyzer(pass *analysis.Pass) (interface{}, error) {
6564

6665
for _, err := range v.errors {
6766
pass.Report(analysis.Diagnostic{
68-
Pos: pass.Fset.File(f.Pos()).Pos(err.Pos.Offset),
69-
Message: "unchecked error",
67+
Pos: pass.Fset.File(f.Pos()).Pos(err.Pos.Offset),
68+
Message: "unchecked error",
69+
Category: "errcheck",
7070
})
7171
}
7272

0 commit comments

Comments
 (0)