File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change 1
1
package analyzer
2
2
3
3
import (
4
+ "errors"
4
5
"flag"
5
6
"go/ast"
6
7
"go/types"
@@ -30,7 +31,10 @@ func run(pass *analysis.Pass) (interface{}, error) {
30
31
reportErrorInDefer := pass .Analyzer .Flags .Lookup (FlagReportErrorInDefer ).Value .String () == "true"
31
32
errorType := types .Universe .Lookup ("error" ).Type ()
32
33
33
- inspector := pass .ResultOf [inspect .Analyzer ].(* inspector.Inspector )
34
+ inspector , ok := pass .ResultOf [inspect .Analyzer ].(* inspector.Inspector )
35
+ if ! ok {
36
+ return nil , errors .New ("failed to get inspector" )
37
+ }
34
38
35
39
// only filter function defintions
36
40
nodeFilter := []ast.Node {
@@ -87,7 +91,7 @@ func run(pass *analysis.Pass) (interface{}, error) {
87
91
}
88
92
})
89
93
90
- return nil , nil
94
+ return nil , nil // nolint:nilnil
91
95
}
92
96
93
97
func findDeferWithVariableAssignment (body * ast.BlockStmt , info * types.Info , variable types.Object ) bool {
You can’t perform that action at this time.
0 commit comments