Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetCachedGoroot ¶ added in v0.14.0
func GetCachedGoroot(config *compileopts.Config) (string, error)
GetCachedGoroot creates a new GOROOT by merging both the standard GOROOT and the GOROOT from TinyGo using lots of symbolic links.
Types ¶
type Error ¶ added in v0.15.0
Error is a regular error but with an added import stack. This is especially useful for debugging import cycle errors.
type Errors ¶
Errors contains a list of parser errors or a list of typechecker errors for the given package.
type Package ¶
type Package struct {
PackageJSON
Files []*ast.File
Pkg *types.Package
// contains filtered or unexported fields
}
Package holds a loaded package, its imports, and its parsed files.
func (*Package) Check ¶
Check runs the package through the typechecker. The package must already be loaded and all dependencies must have been checked already.
Idempotent.
func (*Package) Import ¶
Import implements types.Importer. It loads and parses packages it encounters along the way, if needed.
type PackageJSON ¶ added in v0.15.0
type PackageJSON struct {
Dir string
ImportPath string
Name string
ForTest string
// Source files
GoFiles []string
CgoFiles []string
CFiles []string
// Dependency information
Imports []string
ImportMap map[string]string
// Error information
Error *struct {
ImportStack []string
Pos string
Err string
}
}
PackageJSON is a subset of the JSON struct returned from `go list`.
type Program ¶
type Program struct {
Packages map[string]*Package
// Information obtained during parsing.
LDFlags []string
// contains filtered or unexported fields
}
Program holds all packages and some metadata about the program as a whole.
func Load ¶ added in v0.15.0
func Load(config *compileopts.Config, inputPkgs []string, clangHeaders string, typeChecker types.Config) (*Program, error)
Load loads the given package with all dependencies (including the runtime package). Call .Parse() afterwards to parse all Go files (including CGo processing, if necessary).
func (*Program) LoadSSA ¶
LoadSSA constructs the SSA form of the loaded packages.
The program must already be parsed and type-checked with the .Parse() method.
func (*Program) MainPkg ¶ added in v0.14.0
MainPkg returns the last package in the Sorted() slice. This is the main package of the program.