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 11package analyzer
22
33import (
4+ "errors"
45 "flag"
56 "go/ast"
67 "go/types"
@@ -30,7 +31,10 @@ func run(pass *analysis.Pass) (interface{}, error) {
3031 reportErrorInDefer := pass .Analyzer .Flags .Lookup (FlagReportErrorInDefer ).Value .String () == "true"
3132 errorType := types .Universe .Lookup ("error" ).Type ()
3233
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+ }
3438
3539 // only filter function defintions
3640 nodeFilter := []ast.Node {
@@ -87,7 +91,7 @@ func run(pass *analysis.Pass) (interface{}, error) {
8791 }
8892 })
8993
90- return nil , nil
94+ return nil , nil // nolint:nilnil
9195}
9296
9397func findDeferWithVariableAssignment (body * ast.BlockStmt , info * types.Info , variable types.Object ) bool {
You can’t perform that action at this time.
0 commit comments