GO-INSTALL(1)
π GO-INSTALL(1) π
okay bestie, buckle up β this is go-install from the Go programming tools and commands manual (section 1, obviously π
), and it's literally the command that compiles AND installs your stuff. no cap.
β¨ NAME β¨
go-install β compile and install packages and dependencies π
πΈ SYNOPSIS πΈ
go install [build flags] [packages]
π DESCRIPTION π
Install compiles and installs the packages named by the import paths. that's the whole vibe. slay.
Executables get dropped into the directory named by the GOBIN environment variable, which defaults to $GOPATH/bin, or $HOME/go/bin if the GOPATH environment variable isn't set at all. okay but wait β executables in $GOROOT are special: they go into $GOROOT/bin or $GOTOOLDIR instead of $GOBIN. and cross compiled binaries? those get installed in $GOOS_$GOARCH subdirectories of all of the above. good luck remembering that, i believe in u π«Ά
π¦ the version-suffix situation (iykyk) π¦
If your arguments have version suffixes (like @latest or @v1.0.0), go install builds packages in module-aware mode, and it ignores the go.mod file in the current directory or any parent directory, if there is one. this is genuinely so useful for installing executables without messing up the dependencies of the main module. iconic behavior honestly.
but to eliminate ambiguity about which module versions get used in the build, your arguments must satisfy these constraints:
- Arguments must be package paths or package patterns (with
...wildcards). They must not be standard packages (likefmt), meta-patterns (std,cmd,all), or relative or absolute file paths. - All arguments must have the same version suffix. Different queries are not allowed, even if they refer to the same version.
- All arguments must refer to packages in the same module at the same version.
- Package path arguments must refer to main packages. Pattern arguments will only match main packages.
- No module is considered the "main" module. If the module containing packages named on the command line has a
go.modfile, it must not contain directives (replaceandexclude) that would cause it to be interpreted differently than if it were the main module. The module must not require a higher version of itself. - Vendor directories are not used in any module. (Vendor directories are not included in the module zip files downloaded by
go install.)
ngl that last bullet is a whole mood. vendor dirs are just not invited to this party π
π§ no version suffix? different story π§
If the arguments don't have version suffixes, go install may run in module-aware mode or GOPATH mode, depending on the GO111MODULE environment variable and the presence of a go.mod file. see go help modules for the details bestie. if module-aware mode is enabled, go install runs in the context of the main module.
When module-aware mode is disabled, non-main packages are installed in the directory $GOPATH/pkg/$GOOS_$GOARCH. When module-aware mode is enabled, non-main packages are built and cached but not installed. okay so basically different energy depending on the mode, we love a flexible queen β¨
π the Go 1.20 lore π
Before Go 1.20, the standard library was installed to $GOROOT/pkg/$GOOS_$GOARCH. Starting in Go 1.20, the standard library is built and cached but not installed. Setting GODEBUG=installgoroot=all restores the use of $GOROOT/pkg/$GOOS_$GOARCH. so if you're missing the old ways, there's literally a little time machine lever, no big deal π
For more about build flags, see go help build.
For more about specifying packages, see go help packages.
π SEE ALSO π
π AUTHOR π
This manual page was created using help2man and afterwards updating the output. It is maintained by the Debian Go Compiler Team <team+go-compiler@tracker.debian.org> for the Debian project (and may be used by others). absolute legends, protecting the manual page legacy fr fr π«Ά
okay that's the whole page bestie, go install something cute and remember: cached is not installed, and GOBIN is where the executables live. periodt. π
sign-off: this wasGo 1.27, dated August 2026, from theGo programming tools and commandsmanual. mwah π
π¦ where this page comes from
- ubuntu stonking: golang-go 2:1.27~1 Β· Go
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms