aboutsummaryrefslogtreecommitdiffstats
path: root/gocapturedrefrace.go
diff options
context:
space:
mode:
Diffstat (limited to 'gocapturedrefrace.go')
-rw-r--r--gocapturedrefrace.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/gocapturedrefrace.go b/gocapturedrefrace.go
index 21a0d16..8f79d76 100644
--- a/gocapturedrefrace.go
+++ b/gocapturedrefrace.go
@@ -54,15 +54,19 @@ func checkClosure(pass *analysis.Pass, funcLit *ast.FuncLit) {
ast.Inspect(
funcLit,
func(node ast.Node) bool {
- variable, ok := node.(*ast.Ident)
+ ident, ok := node.(*ast.Ident)
if !ok {
return true
}
+ if ident.Obj == nil {
+ return true
+ }
+
pass.Reportf(
- variable.Pos(),
+ ident.Pos(),
"variable found %q",
- variable,
+ ident,
)
return true