Let's assume I have parsed some code via parser.ParserDir 
<https://godoc.org/go/parser#ParseDir> and get to the *ast.Package 
<https://godoc.org/go/ast#Package> of interest. I can now range the Files 
field (type map[string]*ast.File), taking the key as the file path.

With loader.PackageInfo 
<https://godoc.org/golang.org/x/tools/go/loader#PackageInfo> however there 
is no equivalent; the Files field is instead of type []*ast.File

Am I missing something obvious here?

The use case here is using go/types via go generate. I need to be able to 
constrain my generation according to the $GOFILE environment variable, and 
hence resolve from file path -> *ast.File

Thanks in advance.

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to