Documentation ¶
Overview ¶
Package build provides tools for building Go packages.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrNotFound = os.NewError("go/build: package could not be found locally") ErrTreeNotFound = os.NewError("go/build: no valid GOROOT or GOPATH could be found") )
var DefaultContext = Context{ envOr("GOARCH", runtime.GOARCH), envOr("GOOS", runtime.GOOS), }
The DefaultContext is the default Context for builds. It uses the GOARCH and GOOS environment variables if set, or else the compiled code's GOARCH and GOOS.
var Path []*Tree
Path is a validated list of Trees derived from $GOROOT and $GOPATH at init.
Functions ¶
Types ¶
type Cmd ¶
type Cmd struct { Args []string // command-line Stdout string // write standard output to this file, "" is passthrough Dir string // working directory Env []string // environment Input []string // file paths (dependencies) Output []string // file paths }
A Cmd describes an individual build command.
type Context ¶
A Context specifies the supporting context for a build.
type DirInfo ¶
type DirInfo struct { GoFiles []string // .go files in dir (excluding CgoFiles) CgoFiles []string // .go files that import "C" CFiles []string // .c files in dir SFiles []string // .s files in dir Imports []string // All packages imported by GoFiles TestImports []string // All packages imported by (X)TestGoFiles PkgName string // Name of package in dir TestGoFiles []string // _test.go files in package XTestGoFiles []string // _test.go files outside package }
type Script ¶
A Script describes the build process for a Go package. The Input, Intermediate, and Output fields are lists of absolute paths.
func (*Script) Clean ¶
Clean removes the Script's Intermediate files. It tries to remove every file and returns the first error it encounters.
type Tree ¶
Tree describes a Go source tree, either $GOROOT or one from $GOPATH.
func FindTree ¶
FindTree takes an import or filesystem path and returns the tree where the package source should be and the package import path.
func (*Tree) HasPkg ¶
HasPkg returns whether the given package's object file can be found inside this Tree.
func (*Tree) HasSrc ¶
HasSrc returns whether the given package's source can be found inside this Tree.