golang

package
v6.0.0+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 14, 2019 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Overview

Package golang is an API to the Go compiler.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BuildOpts

type BuildOpts struct {
	// ExtraArgs to `go build`.
	ExtraArgs []string
}

Optional arguments to Environ.Build.

type Environ

type Environ struct {
	build.Context
}

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

func (c Environ) Build(importPath string, binaryPath string, opts BuildOpts) error

Build compiles the package given by `importPath`, writing the build object to `binaryPath`.

func (Environ) BuildDir

func (c Environ) BuildDir(dirPath string, binaryPath string, opts BuildOpts) error

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) Env

func (c Environ) Env() []string

func (Environ) Package

func (c Environ) Package(importPath string) (*build.Package, error)

Package retrieves information about a package by its Go import path.

func (Environ) PackageByPath

func (c Environ) PackageByPath(path string) (*build.Package, error)

PackageByPath retrieves information about a package by its file system path.

`path` is assumed to be the directory containing the package.

func (Environ) String

func (c Environ) String() string

func (Environ) Version

func (c Environ) Version() (string, error)

Version returns the Go version string that runtime.Version would return for the Go compiler in this environ.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL