Go tools with pinned versions can now be tracked with the go mod system.
$ go get -tool <package>
This adds tool dependency entries in go.mod
. Then update the go mod cache:
$ go mod download
$ go mod vendor
$ go mod tidy
This optimizes the go.mod
configuration. Then read the file contents and confirm the desired version identifiers. If necessary, adjust the versions and update the go mod cache again.
Then instruct Go to emit binaries to $GOBIN
.
$ go install tool
This is essential for integrating with go vet
.
Note that unpinned (@latest
) packages may not be tracked via go mod. For example, the govulncheck SCA utility should be downloaded in terms of the latest stable release. Such packages can be managed via traditional go install <package>
commands:
$ go install golang.org/x/vuln/cmd/govulncheck@latest