.\" 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 based on the output of \(oqgo help get' for the Debian project (and may be used by others).