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(files []string) (*token.FileSet, *ast.Package, error)
- func RewritePackage(env golang.Environ, pkgPath, bbImportPath string, importer types.Importer) error
- func SrcFiles(p *build.Package) []string
- 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 ParseAST ¶
ParseAST parses the given files for a package named main.
Only files with a matching package statement will be part of the AST returned.
func RewritePackage ¶
func RewritePackage(env golang.Environ, pkgPath, 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 { // Name is the command name. // // In the standard Go tool chain, this is usually the base name of the // directory containing its source files. Name string // 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 ¶
func NewPackage(name string, pkgPath string, srcFiles []string, importer types.Importer) (*Package, error)
NewPackage gathers AST, type, and token information about a command.
The given importer is used to resolve dependencies.