Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/go: go get forces upgrade without -u #35135

Closed
ucirello opened this issue Oct 24, 2019 · 1 comment
Closed

cmd/go: go get forces upgrade without -u #35135

ucirello opened this issue Oct 24, 2019 · 1 comment

Comments

@ucirello
Copy link
Contributor

What version of Go are you using (go version)?

$ go version
go version go1.13.3 darwin/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/user/Library/Caches/go-build"
GOENV="/Users/user/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/user/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/user/gobug/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/_l/9yb78fmx0jzb8khycvrzw3qw0000gn/T/go-build968937557=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

With this environment: https://play.golang.org/p/bUF9KgVU1ow
I execute either

go get -tags tools github.com/gogo/protobuf/protoc-gen-gofast

or

go get github.com/gogo/protobuf/protoc-gen-gofast

What did you expect to see?

Silent output - and protoc-gen-gofast v1.2.1 installed

What did you see instead?

It upgrades to v1.3.1

$ go get github.com/gogo/protobuf/protoc-gen-gofast
go: finding github.com/gogo/protobuf v1.3.1
go: downloading github.com/gogo/protobuf v1.3.1
go: extracting github.com/gogo/protobuf v1.3.1
$ go get -tags tools github.com/gogo/protobuf/protoc-gen-gofast
go: finding github.com/gogo/protobuf v1.3.1
go: downloading github.com/gogo/protobuf v1.3.1
go: extracting github.com/gogo/protobuf v1.3.1
@bcmills
Copy link
Contributor

bcmills commented Oct 24, 2019

This is working as documented. Per https://golang.org/cmd/go/#hdr-Add_dependencies_to_current_module_and_install_them:

For each named package or package pattern, get must decide which version of the corresponding module to use. By default, get looks up the latest tagged release version, such as v0.4.5 or v1.2.3.

If you just want to install the current version of a binary already in your module's dependencies, use go install rather than go get.

@bcmills bcmills closed this as completed Oct 24, 2019
@golang golang locked and limited conversation to collaborators Oct 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants