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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
.\" Hey, EMACS: -*- nroff -*-
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.TH GO-GET 1 "2021-10-15"
.\" Please adjust this date whenever revising the manpage.
.SH NAME
go-get \- add dependencies to current module and install them
.SH SYNOPSIS
.B go get
.RB [\|\-t\|]
.RB [\|\-u\|]
.RB [\|\-v\|]
.RI [ "build flags" ]
.RI [ packages ]
.SH DESCRIPTION
Get resolves its command-line arguments to packages at specific module versions,
updates go.mod to require those versions, and downloads source code into the
module cache.
.P
To add a dependency for a package or upgrade it to its latest version:
.Vb 6
\& go get example.com/pkg
.Ve
.P
To upgrade or downgrade a package to a specific version:
.Vb 6
\& go get example.com/pkg@v1.2.3
.Ve
.P
To remove a dependency on a module and downgrade modules that require it:
.Vb 6
\& go get example.com/mod@none
.Ve
.P
See https://golang.org/ref/mod#go-get for details.
.P
In earlier versions of Go, \(oqgo get\(cq was used to build and install packages.
Now, \(oqgo get\(cq is dedicated to adjusting dependencies in go.mod. \(oqgo install'
may be used to build and install commands instead. When a version is specified,
\(oqgo install\(cq runs in module-aware mode and ignores the go.mod file in the
current directory. For example:
.Vb 6
\& go install example.com/pkg@v1.2.3
\& go install example.com/pkg@latest
.Ve
.P
See \(oqgo help install\(cq or https://golang.org/ref/mod#go-install for details.
.P
\(oqgo get\(cq accepts the following flags.
.TP
.B \-t
The \-t flag instructs get to consider modules needed to build tests of
packages specified on the command line.
.TP
.B \-u
The \-u flag instructs get to update modules providing dependencies
of packages named on the command line to use newer minor or patch
releases when available.
.TP
.BI \-u= patch
The \-u=\fIpatch\fP flag (not \-u \fIpatch\fP) also instructs get to update dependencies,
but changes the default to select patch releases.
.P
When the \-t and \-u flags are used together, get will update
test dependencies as well.
.TP
.B \-x
The \-x flag prints commands as they are executed. This is useful for
debugging version control commands when a module is downloaded directly
from a repository.
.P
For more about modules, see https://golang.org/ref/mod.
.P
For more about specifying packages, see \fBgo-packages\fP(7).
.P
This text describes the behavior of get using modules to manage source
code and dependencies. If instead the go command is running in GOPATH
mode, the details of get's flags and effects change, as does \(oqgo help get'.
See \(oqgo help gopath-get\(cq or \fBgo-gopath-get\fP(1).
.SH SEE ALSO
.BR go-build (1),
.BR go-install (1),
.BR go-clean (1).
.BR go-mod (1).
.SH AUTHOR
This manual page and is maintained by the
Debian Go Compiler Team <team+go-compiler@tracker.debian.org>
based on the output of \(oqgo help get'
for the Debian project (and may be used by others).
|