Documentation ¶
Overview ¶
Package loader wraps golang.org/x/tools/go/packages with utility types and methods
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Program ¶
type Program struct { // Fset contains the entire program Fset Fset *token.FileSet // AllPackages is the list of all loaded packages for a program. // It is this exposed this way to match the old loader API. AllPackages map[*types.Package]*packages.Package }
Program provides access to various elements of a type checked set of packages. Fset and AllPackages are not so easily combined, we often need to query the entire program ast which contains all packages, often needing additional information within any given package after that.
func (*Program) PathEnclosingInterval ¶
func (prog *Program) PathEnclosingInterval(start, end token.Pos) (pkg *packages.Package, path []ast.Node, exact bool)
PathEnclosingInterval returns the PackageInfo and ast.Node that contain source interval [start, end), and all the node's ancestors up to the AST root. It searches all ast.Files of all packages in prog. exact is defined as for astutil.PathEnclosingInterval.
The zero value is returned if not found.