summaryrefslogtreecommitdiffstats
path: root/man/go-install.1
blob: 5b1d9d8cfe8c36140d2a3904287efbef12335311 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
.\"                                      Hey, EMACS: -*- nroff -*-
.TH GO-INSTALL 1 "2022-03-15"
.\" Please adjust this date whenever revising the manpage.
.SH NAME
go \- tool for managing Go source code
.SH SYNOPSIS
.B go install
.RI [ "build flags" ]
.RI [ packages ]
.SH DESCRIPTION
Install compiles and installs the packages named by the import paths.
.P
Executables are installed in the directory named by the GOBIN environment
variable, which defaults to $GOPATH/bin or $HOME/go/bin if the GOPATH
environment variable is not set. Executables in $GOROOT
are installed in $GOROOT/bin or $GOTOOLDIR instead of $GOBIN.
.P
If the arguments have version suffixes (like @latest or @v1.0.0), "go install"
builds packages in module-aware mode, ignoring the go.mod file in the current
directory or any parent directory, if there is one. This is useful for
installing executables without affecting the dependencies of the main module.
To eliminate ambiguity about which module versions are used in the build, the
arguments must satisfy the following constraints:
.IP \[bu] 2
Arguments must be package paths or package patterns (with "..." wildcards).
They must not be standard packages (like fmt), meta-patterns (std, cmd,
all), or relative or absolute file paths.
.IP \[bu]
All arguments must have the same version suffix. Different queries are not
allowed, even if they refer to the same version.
.IP \[bu]
All arguments must refer to packages in the same module at the same version.
.IP \[bu]
Package path arguments must refer to main packages. Pattern arguments
will only match main packages.
.IP \[bu]
No module is considered the "main" module. If the module containing
packages named on the command line has a go.mod file, it must not contain
directives (replace and exclude) 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.
.IP \[bu]
Vendor directories are not used in any module. (Vendor directories are not
included in the module zip files downloaded by \(oqgo install\(cq.)
.P
If the arguments don\(cqt 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 \(oqgo help modules\(cq for details.
If module-aware mode is enabled, "go install" runs in the context of the main
module.
.P
When module-aware mode is disabled, other packages are installed in the
directory $GOPATH/pkg/$GOOS_$GOARCH. When module-aware mode is enabled,
other packages are built and cached but not installed.
.P
The \-i flag installs the dependencies of the named packages as well.
.br
The \-i flag is deprecated. Compiled packages are cached automatically.
.P
For more about the build flags, see \fBgo-build\fP(1).
.br
For more about specifying packages, see \fBgo-packages\fP(7).
.SH SEE ALSO
.BR go-build (1),
.BR go-get (1),
.BR go-clean (1).
.SH AUTHOR
.PP
This manual page was written by Michael Stapelberg <stapelberg@debian.org>
and is maintained by the
Debian Go Compiler Team <team+go-compiler@tracker.debian.org>
based on the output of \(oqgo help install\(cq
for the Debian project (and may be used by others).