Documentation ¶
Index ¶
- func BuildBusybox(env golang.Environ, pkgs []string, binaryPath string) error
- func CreateBBMainSource(fset *token.FileSet, astp *ast.Package, pkgs []string, destDir string) error
- func ParseAST(p *build.Package) (*token.FileSet, *ast.Package, error)
- func RewritePackage(env golang.Environ, pkgPath, destDir, bbImportPath string, ...) error
- type Package
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildBusybox ¶
BuildBusybox builds a busybox of the given Go packages.
pkgs is a list of Go import paths. If nil is returned, binaryPath will hold the busybox-style binary.
func CreateBBMainSource ¶
func CreateBBMainSource(fset *token.FileSet, astp *ast.Package, pkgs []string, destDir string) error
CreateBBMainSource creates a bb Go command that imports all given pkgs.
p must be the bb template.
- For each pkg in pkgs, add import _ "pkg" to astp's first file.
- Write source file out to destDir.
func RewritePackage ¶
func RewritePackage(env golang.Environ, pkgPath, destDir, bbImportPath string, importer types.Importer) error
RewritePackage rewrites pkgPath to be bb-mode compatible, where destDir is the file system destination of the written files and bbImportPath is the Go import path of the bb package to register with.
Types ¶
type Package ¶
type Package struct {
// contains filtered or unexported fields
}
Package is a Go package.
It holds AST, type, file, and Go package information about a Go package.
func NewPackage ¶
NewPackage gathers AST, type, and token information about package p, using the given importer to resolve dependencies.