diff options
author | Teddy Wing | 2023-05-16 20:31:28 +0200 |
---|---|---|
committer | Teddy Wing | 2023-05-16 20:31:28 +0200 |
commit | 21373e26ed585b0b7cbc29f31b71744ce6409934 (patch) | |
tree | fcc57c684eed3664692a14891706df1ac3cee5e9 | |
parent | 06c668edd231d90b4f3ddc729ca47102e5625662 (diff) | |
download | gocapturedrefrace-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.go | 6 |
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 |