Documentation ¶
Overview ¶
Package golang is an API to the Go compiler.
Index ¶
- type BuildOpts
- type Environ
- func (c Environ) Build(importPath string, binaryPath string, opts BuildOpts) error
- func (c Environ) BuildDir(dirPath string, binaryPath string, opts BuildOpts) error
- func (c Environ) Deps(importPath string) (*ListPackage, error)
- func (c Environ) Env() []string
- func (c Environ) GoCmd(args ...string) *exec.Cmd
- func (c Environ) Package(importPath string) (*build.Package, error)
- func (c Environ) PackageByPath(path string) (*build.Package, error)
- func (c Environ) String() string
- func (c Environ) Version() (string, error)
- type ListPackage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BuildOpts ¶
type BuildOpts struct { // NoStrip builds an unstripped binary. NoStrip bool // ExtraArgs to `go build`. ExtraArgs []string }
Optional arguments to Environ.Build.
type Environ ¶
func Default ¶
func Default() Environ
Default is the default build environment comprised of the default GOPATH, GOROOT, GOOS, GOARCH, and CGO_ENABLED values.
func (Environ) Build ¶
Build compiles the package given by `importPath`, writing the build object to `binaryPath`.
func (Environ) BuildDir ¶
BuildDir compiles the package in the directory `dirPath`, writing the build object to `binaryPath`.
func (Environ) Deps ¶
func (c Environ) Deps(importPath string) (*ListPackage, error)
Deps lists all dependencies of the package given by `importPath`.
func (Environ) PackageByPath ¶
PackageByPath retrieves information about a package by its file system path.
`path` is assumed to be the directory containing the package.
type ListPackage ¶
type ListPackage struct { Dir string Deps []string GoFiles []string SFiles []string HFiles []string Goroot bool Root string ImportPath string }
ListPackage matches a subset of the JSON output of the `go list -json` command.
See `go help list` for the full structure.
This currently contains an incomplete list of dependencies.