LinuxCommandLibrary

go-install

compile and install Go packages and binaries

TLDR

Install a package from current module

$ go install
copy
Install specific package
$ go install [package]
copy
Install latest version of a tool
$ go install [example.com/tool]@latest
copy
Install specific version
$ go install [example.com/tool]@v1.2.3
copy
Install with verbose output
$ go install -v [package]
copy

SYNOPSIS

go install [build flags] [packages]

DESCRIPTION

go install compiles and installs packages and their dependencies. Executables are installed to the directory named by the GOBIN environment variable, defaulting to $GOPATH/bin or $HOME/go/bin. When used with an @version suffix, it installs in module-aware mode regardless of the current directory, ignoring any go.mod present.

PARAMETERS

-v

Print package names as compiled.
-n
Print commands without executing.
-x
Print commands as executed.
@version
Install specific version (latest, v1.2.3, etc.).

CAVEATS

Use @latest or @version to install tools independent of current module. Without a version suffix, go install uses dependencies from the current module's go.mod.

SEE ALSO

go(1), go-build(1), go-get(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community