Using GO111MODULE=off, you are falling back on the GOPATH method of installing the binary. In GOPATH mode, the master branch is always going to be the one checked out.
With GO111MODULE=on, you can rely on versions (i.e, git tags). The command
(cd&&GO111MODULE=on go get -u golang.org/x/tools/cmd/goimports)
will fetch the latest tag. The great benefit of this method is that you can pin-point the version to a branch or a tag or a commit:
(cd&&GO111MODULE=on go get -u golang.org/x/tools/cmd/goimports@2363391)
And since Go 1.16, the command has been greatly simplified (as long as there is no replace directive in goimport's go.mod):
go install golang.org/x/tools/cmd/goimports@2363391
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Using
GO111MODULE=off
, you are falling back on the GOPATH method of installing the binary. In GOPATH mode, the master branch is always going to be the one checked out.With
GO111MODULE=on
, you can rely on versions (i.e, git tags). The commandwill fetch the
latest
tag. The great benefit of this method is that you can pin-point the version to a branch or a tag or a commit:And since Go 1.16, the command has been greatly simplified (as long as there is no
replace
directive in goimport's go.mod):