GO-GET(1) | General Commands Manual | GO-GET(1) |
go-get - add dependencies to current module and install them
go get [-t] [-u] [-v] [build flags] [packages]
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.
To add a dependency for a package or upgrade it to its latest version:
go get example.com/pkg
To upgrade or downgrade a package to a specific version:
go get example.com/pkg@v1.2.3
To remove a dependency on a module and downgrade modules that require it:
go get example.com/mod@none
See https://golang.org/ref/mod#go-get for details.
In earlier versions of Go, ‘go get’ was used to build and install packages. Now, ‘go get’ is dedicated to adjusting dependencies in go.mod. ‘go install' may be used to build and install commands instead. When a version is specified, ‘go install’ runs in module-aware mode and ignores the go.mod file in the current directory. For example:
go install example.com/pkg@v1.2.3 go install example.com/pkg@latest
See ‘go help install’ or https://golang.org/ref/mod#go-install for details.
‘go get’ accepts the following flags.
When the -t and -u flags are used together, get will update test dependencies as well.
For more about modules, see https://golang.org/ref/mod.
For more about specifying packages, see go-packages(7).
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 ‘go help get'. See ‘go help gopath-get’ or go-gopath-get(1).
go-build(1), go-install(1), go-clean(1). go-mod(1).
This manual page and is maintained by the Debian Go Compiler Team <team+go-compiler@tracker.debian.org> based on the output of ‘go help get' for the Debian project (and may be used by others).
2021-10-15 |