gocmd

package
v0.27.2 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CommandInstall represents go "install" command.
	CommandInstall = "install"

	// CommandGet represents go "get" command.
	CommandGet = "get"

	// CommandBuild represents go "build" command.
	CommandBuild = "build"

	// CommandMod represents go "mod" command.
	CommandMod = "mod"

	// CommandModTidy represents go mod "tidy" command.
	CommandModTidy = "tidy"

	// CommandModVerify represents go mod "verify" command.
	CommandModVerify = "verify"

	// CommandFmt represents go "fmt" command.
	CommandFmt = "fmt"

	// CommandEnv represents go "env" command.
	CommandEnv = "env"

	// EnvGOARCH represents GOARCH variable.
	EnvGOARCH = "GOARCH"
	// EnvGOMOD represents GOMOD variable.
	EnvGOMOD = "GOMOD"
	// EnvGOOS represents GOOS variable.
	EnvGOOS = "GOOS"

	// FlagGcflags represents gcflags go flag.
	FlagGcflags = "-gcflags"
	// FlagGcflagsValueDebug represents debug go flags.
	FlagGcflagsValueDebug = "all=-N -l"
	// FlagLdflags represents ldflags go flag.
	FlagLdflags = "-ldflags"
	// FlagTags represents tags go flag.
	FlagTags = "-tags"
	// FlagMod represents mod go flag.
	FlagMod = "-mod"
	// FlagModValueReadOnly represents readonly go flag.
	FlagModValueReadOnly = "readonly"
	// FlagOut represents out go flag.
	FlagOut = "-o"
)

Variables

This section is empty.

Functions

func Build added in v0.26.0

func Build(ctx context.Context, out, path string, flags []string, options ...exec.Option) error

Build runs go build on path with options.

func BuildPath

func BuildPath(ctx context.Context, output, binary, path string, flags []string, options ...exec.Option) error

BuildPath runs go install on cmd folder with options.

func BuildTarget

func BuildTarget(goos, goarch string) string

BuildTarget builds a GOOS:GOARCH pair.

func Env added in v0.26.0

func Env(name string) (string, error)

Env returns the value of `go env name`.

func Fmt added in v0.25.0

func Fmt(ctx context.Context, path string, options ...exec.Option) error

Fmt runs go fmt on path.

func Get added in v0.25.0

func Get(ctx context.Context, path string, pkgs []string, options ...exec.Option) error

Get runs go get pkgs on path with options.

func Install added in v0.25.0

func Install(ctx context.Context, path string, pkgs []string, options ...exec.Option) error

Install runs go install pkgs on path with options.

func InstallAll

func InstallAll(ctx context.Context, path string, flags []string, options ...exec.Option) error

InstallAll runs go install ./... on path with options.

func IsInstallError added in v0.27.0

func IsInstallError(err error) bool

IsInstallError returns true if err is interpreted as a go install error.

func Ldflags

func Ldflags(flags ...string) string

Ldflags returns a combined ldflags set from flags.

func ModTidy

func ModTidy(ctx context.Context, path string, options ...exec.Option) error

ModTidy runs go mod tidy on path with options.

func ModVerify

func ModVerify(ctx context.Context, path string, options ...exec.Option) error

ModVerify runs go mod verify on path with options.

func Name

func Name() string

Name returns the name of Go binary to use.

func PackageLiteral

func PackageLiteral(path, version string) string

PackageLiteral returns the string representation of package part of go get [package].

func ParseTarget

func ParseTarget(t string) (goos, goarch string, err error)

ParseTarget parses GOOS:GOARCH pair.

func Tags added in v0.27.0

func Tags(tags ...string) string

Tags returns a combined tags set from flags.

Types

This section is empty.

Jump to

Keyboard shortcuts

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