On Sun, 2020-09-27 at 11:45 -0700, Glen Mailer wrote:
> 
> Hello!
> 
> I'm playing about with some go tooling, and I wanted to parse a
> package with type information to inspect it and derive some insights
> from the data.
> 
> I found the packages tool - 
> https://godoc.org/golang.org/x/tools/go/packages - which on the
> surface appears to be exactly what I wanted.
> 
> However the output of this on a package (with all flags enabled)
> appears to be a slice of *ast.File nodes - which contain unresolved
> references, and a types.Package - from which I can inspect scopes.
> 
> I can't seem to find a way to inspect the resolved AST along with
> types - am I missing something or do I need to do more legwork
> myself?
> 
> Cheers
> Glen


The TypesInfo field of packages.Package holds the information you want.
https://godoc.org/golang.org/x/tools/go/packages#Package


-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/f8f2d9a19973a374b49d855034d361799050a5b1.camel%40kortschak.io.

Reply via email to