Skip to content

Commit fe494af

Browse files
ernadojirfag
authored andcommitted
govet: skip internal analyzers (#763)
Some analyzers are not intended for direct usage and are just build blocks for other analyzers. Seems like we can distinguish them by ResultType nillness.
1 parent 605c9c2 commit fe494af

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

pkg/golinters/govet.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ import (
4343
)
4444

4545
func getAllAnalyzers() []*analysis.Analyzer {
46-
return []*analysis.Analyzer{
46+
var analyzers []*analysis.Analyzer
47+
for _, a := range []*analysis.Analyzer{
4748
asmdecl.Analyzer,
4849
assign.Analyzer,
4950
atomic.Analyzer,
@@ -76,7 +77,14 @@ func getAllAnalyzers() []*analysis.Analyzer {
7677
unreachable.Analyzer,
7778
unsafeptr.Analyzer,
7879
unusedresult.Analyzer,
80+
} {
81+
if a.ResultType != nil {
82+
// Skipping internal analyzers.
83+
continue
84+
}
85+
analyzers = append(analyzers, a)
7986
}
87+
return analyzers
8088
}
8189

8290
func getDefaultAnalyzers() []*analysis.Analyzer {

0 commit comments

Comments
 (0)