diff options
author | Teddy Wing | 2023-05-16 20:18:32 +0200 |
---|---|---|
committer | Teddy Wing | 2023-05-16 20:18:32 +0200 |
commit | 13906a78ef608d790fe0b65e96aee7ea4a411755 (patch) | |
tree | 9c2f7fcf8be3de4cf533b5a3a888d05e027f87d2 | |
parent | 8003b534234a6684d567c932cf9033da7b8bf34b (diff) | |
download | gocapturedrefrace-13906a78ef608d790fe0b65e96aee7ea4a411755.tar.bz2 |
Ignore variables defined in the function closure
This correctly ignores local variables.
-rw-r--r-- | gocapturedrefrace.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/gocapturedrefrace.go b/gocapturedrefrace.go index e1f2d41..1353d7d 100644 --- a/gocapturedrefrace.go +++ b/gocapturedrefrace.go @@ -128,6 +128,11 @@ func checkClosure( fmt.Printf("In function scope %v\n", scopeObj) } + // Identifier is local to the closure. + if scope == nil && scopeObj == nil { + return true + } + if funcScope != scope { pass.Reportf( ident.Pos(), |