build

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package build provides a task for the Go toolchain "build" command.

Index

Constants

View Source
const (
	// DefaultDistOutputDirName is the default directory name for production and distribution builds.
	DefaultDistOutputDirName = "dist"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*Options)

Option is a task option.

func WithBinaryArtifactName

func WithBinaryArtifactName(name string) Option

WithBinaryArtifactName sets the name for the binary build artifact.

func WithCrossCompileTargetPlatforms

func WithCrossCompileTargetPlatforms(platforms ...string) Option

WithCrossCompileTargetPlatforms sets the names of cross-compile platform targets.

func WithFlags

func WithFlags(flags ...string) Option

WithFlags sets additional flags to pass to the Go `build` command along with the base Go flags.

func WithGoOptions

func WithGoOptions(goOpts ...taskGo.Option) Option

WithGoOptions sets shared Go toolchain task options.

func WithOutputDir

func WithOutputDir(dir string) Option

WithOutputDir sets the output directory, relative to the project root, for compilation artifacts.

type Options

type Options struct {
	*taskGo.Options

	// BinaryArtifactName is the name for the binary build artifact.
	BinaryArtifactName string

	// CrossCompileTargetPlatforms are the names of cross-compile platform targets.
	//
	// See `go tool dist list` and the `go` command documentations for more details:
	//   - https://github.com/golang/go/blob/master/src/cmd/dist/build.go
	CrossCompileTargetPlatforms []string

	// Flags are additional flags to pass to the Go `build` command along with the base Go flags.
	//
	// See `go help build` and the Go command documentation for more details:
	//   - https://golang.org/cmd/go/#hdr-Compile_packages_and_dependencies
	Flags []string

	// OutputDir is the output directory, relative to the project root, for compilation artifacts.
	OutputDir string
	// contains filtered or unexported fields
}

Options are task options.

func NewOptions

func NewOptions(opts ...Option) *Options

NewOptions creates new task options.

type Task

type Task struct {
	// contains filtered or unexported fields
}

Task is a task for the Go toolchain "build" command.

func New

func New(ac app.Config, opts ...Option) *Task

New creates a new task for the Go toolchain "build" command.

func (*Task) BuildParams

func (t *Task) BuildParams() []string

BuildParams builds the parameters. Note that configured flags are applied after the "GOFLAGS" environment variable and could overwrite already defined flags.

See `go help environment`, `go help env` and the `go` command documentations for more details:

func (*Task) Env

func (t *Task) Env() map[string]string

Env returns the task specific environment.

func (*Task) Kind

func (t *Task) Kind() task.Kind

Kind returns the task kind.

func (*Task) Name added in v0.6.0

func (t *Task) Name() string

Name returns the task name.

func (*Task) Options

func (t *Task) Options() task.Options

Options returns the task options.

Jump to

Keyboard shortcuts

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