From d75790724acc77890acdbe4e1894e287e4db9b46 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Thu, 18 May 2023 01:54:39 +0200 Subject: Create a new plan for checking shadowing --- gocapturedrefrace.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gocapturedrefrace.go b/gocapturedrefrace.go index 369b107..cdc6486 100644 --- a/gocapturedrefrace.go +++ b/gocapturedrefrace.go @@ -37,6 +37,7 @@ var Analyzer = &analysis.Analyzer{ } func run(pass *analysis.Pass) (interface{}, error) { + // TODO: Since we're calling ast.Inspect a bunch of times, maybe it's worthwhile using passes/inspect now. for _, file := range pass.Files { ast.Inspect( file, @@ -144,6 +145,8 @@ func isShadowingDeclaration( node ast.Node, funcScope *types.Scope, ) bool { + // TODO: Plan: Change this function to checkShadowing. Call ast.Inspect and build a list of local assignments in the closure. Then in checkClosure, ignore objects in the local assignments list. + assignStmt, ok := node.(*ast.AssignStmt) if !ok { return false -- cgit v1.2.3