aboutsummaryrefslogtreecommitdiffstats
path: root/capturedrefrace.go
diff options
context:
space:
mode:
Diffstat (limited to 'capturedrefrace.go')
-rw-r--r--capturedrefrace.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/capturedrefrace.go b/capturedrefrace.go
index e7d0c45..afb104c 100644
--- a/capturedrefrace.go
+++ b/capturedrefrace.go
@@ -51,6 +51,7 @@
package capturedrefrace
import (
+ "fmt"
"go/ast"
"go/token"
"go/types"
@@ -83,6 +84,18 @@ func run(pass *analysis.Pass) (interface{}, error) {
return
}
+ fmt.Printf("func: %#v\n", goStmt.Call.Fun)
+ funcIdent, ok := goStmt.Call.Fun.(*ast.Ident)
+ if ok {
+ fmt.Printf("funcobj: %#v\n", funcIdent.Obj)
+ t := pass.TypesInfo.Types[funcIdent]
+ fmt.Printf("functype-fromtypesinfo: %#v\n", t)
+ fmt.Printf("funcdecl: %#v\n", funcIdent.Obj.Decl)
+ obj := pass.TypesInfo.Uses[funcIdent]
+ fmt.Printf("funcobj-fromtypesinfo: %#v\n", obj)
+ fmt.Printf("funcobj-fromtypesinfo-type: %#v\n", obj.Type())
+ }
+
// Look for a function literal after the `go` statement.
funcLit, ok := goStmt.Call.Fun.(*ast.FuncLit)
if !ok {