cmd

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BuildOption

type BuildOption func(*buildOpts) error

BuildOption are used to specify build options.

func OptBuildPackages

func OptBuildPackages(packages ...string) BuildOption

OptBuildPackages adds package(s) to the build.

func OptBuildWithBuiltBy

func OptBuildWithBuiltBy(s string) BuildOption

OptBuildWithBuiltBy sets the building entity (ex. mage, goreleaser).

When supplied, the linker sets main.builtBy to the supplied value.

func OptBuildWithGitDescription

func OptBuildWithGitDescription(d *git.Description) BuildOption

OptBuildWithGitDescription sets values in the build according to the supplied git description.

When supplied, main.commit and main.state values are set to reflect d. If the working directory described by d is clean, main.date is set to reflect the commit time. Otherwise, main.date is set to the current time. If d contains a version, the linker sets main.version to that value.

type Command

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

Command represents a go tool command.

func NewBuildCommand

func NewBuildCommand(opts ...BuildOption) (*Command, error)

NewBuildCommand returns a Command that builds packages, configured by opts. Flags are set to omit the symbol table, debug information, and DWARF symbol table. A flag is set to ensure file system paths are removed, which assists in reproducible builds.

By default, all packages are built. To change this, use OptBuildPackages.

To set a building entity, consider using OptBuildWithBuiltBy. To set variables according to a git description, consider using OptBuildWithGitDescription.

func NewInstallCommand

func NewInstallCommand(opts ...BuildOption) (*Command, error)

NewInstallCommand returns a Command that installs packages, configured by opts. Flags are set to omit the symbol table, debug information, and DWARF symbol table. A flag is set to ensure file system paths are removed, which assists in reproducible builds.

By default, packages in ./cmd/... are installed. To change this, use OptBuildPackages.

To set a building entity, consider using OptBuildSetBuiltBy. To set variables according to a git description, consider using OptBuildWithGitDescription.

func NewTestCommand

func NewTestCommand(opts ...TestOption) (*Command, error)

NewTestCommand returns a Command that tests all packages, configured by opts. Data race detection is always enabled.

By default, all packages are tested. To change this, use OptTestPackages.

By default, test coverage is written to standard output only. To write a test coverage profile, consider using OptTestWithCoverPath.

func (*Command) Args

func (c *Command) Args() []string

Args returns the command arguments.

func (*Command) Env

func (c *Command) Env() map[string]string

Env returns the command environment.

type TestOption

type TestOption func(*testOpts) error

TestOption are used to specify testing options.

func OptTestPackages

func OptTestPackages(packages ...string) TestOption

OptTestPackages adds package(s) to test.

func OptTestWithCoverPath

func OptTestWithCoverPath(path string) TestOption

OptTestWithCoverPath sets path as the location to write a test coverage profile.

Jump to

Keyboard shortcuts

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