diff options
Diffstat (limited to 'gocapturedrefrace.go')
-rw-r--r-- | gocapturedrefrace.go | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/gocapturedrefrace.go b/gocapturedrefrace.go index 50a0297..c3d5d82 100644 --- a/gocapturedrefrace.go +++ b/gocapturedrefrace.go @@ -69,13 +69,22 @@ func run(pass *analysis.Pass) (interface{}, error) { fmt.Printf("funcLit params: %#v\n", funcLit.Type.Params.List) for _, arg := range funcLit.Type.Params.List { - fmt.Printf("funcLit param:") - - for _, argNameIdent := range arg.Names { - fmt.Printf("%#v, ", argNameIdent.Name) + fmt.Printf( + "funcLit param: %s ; type: %#v\n", + arg.Names[0].Name, + arg.Type, + ) + + _, ok := arg.Type.(*ast.StarExpr) + if !ok { + continue } - fmt.Println() + pass.Reportf( + arg.Pos(), + "reference %s in goroutine closure", + arg.Names[0], + ) } // scope := pass.TypesInfo.Scopes[funcLit] |