aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2023-05-16 20:31:28 +0200
committerTeddy Wing2023-05-16 20:31:28 +0200
commit21373e26ed585b0b7cbc29f31b71744ce6409934 (patch)
treefcc57c684eed3664692a14891706df1ac3cee5e9
parent06c668edd231d90b4f3ddc729ca47102e5625662 (diff)
downloadgocapturedrefrace-21373e26ed585b0b7cbc29f31b71744ce6409934.tar.bz2
Ignore any identifier that isn't a *types.Var
Otherwise we can get `*types.TypeName` identifiers, like the variable types in the closure's argument list. We only want to inspect variables.
-rw-r--r--gocapturedrefrace.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/gocapturedrefrace.go b/gocapturedrefrace.go
index 7f5d16d..3174a09 100644
--- a/gocapturedrefrace.go
+++ b/gocapturedrefrace.go
@@ -133,6 +133,11 @@ func checkClosure(
return true
}
+ _, ok = scopeObj.(*types.Var)
+ if !ok {
+ return true
+ }
+
if funcScope != scope {
pass.Reportf(
ident.Pos(),
@@ -141,7 +146,6 @@ func checkClosure(
)
}
- // TODO: Ignore `aStruct` type
// TODO: Report references in argument list
return true