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: get doesn't select dependencies limited to go@version #67574

Open
alexander-bachmann opened this issue May 22, 2024 · 3 comments
Open
Assignees
Labels
GoCommand cmd/go modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.

Comments

@alexander-bachmann
Copy link

alexander-bachmann commented May 22, 2024

Go version

go version go1.21.8 darwin/amd64

Output of go env in your module/workspace:

GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/Users/aoeu/Library/Caches/go-build'
GOENV='/Users/aoeu/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/aoeu/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/aoeu/go'
GOPRIVATE=''
GOPROXY=''
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='local'
GOTOOLDIR='/usr/local/go/pkg/tool/darwin_amd64'
GOVCS=''
GOVERSION='go1.21.8'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='clang'
CXX='clang++'
CGO_ENABLED='1'
GOMOD='/Users/aoeu/Desktop/just-a-test/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/sm/14wxd09941l27xkmt31qrz3h0000gq/T/go-build2401627713=/tmp/go-build -gno-record-gcc-switches -fno-common'

What did you do?

we would like to stay on golang version 1.21 and still be able to update our dependencies using go get -u ./...

the problem is that go get doesn’t respect the local toolchain version and attempts to pull in module versions that are newer than the local toolchain

we found this solution #59886 (comment) but it doesn’t seem to work as seen in the example below:

% go version
go version go1.21.8 darwin/amd64

% export GOTOOLCHAIN=local

% go get k8s.io/client-go go@1.21.8
go: k8s.io/client-go@v0.30.1 requires go >= 1.22.0 (running go 1.21.8; GOTOOLCHAIN=local)

I also attempted with go get k8s.io/client-go go@1.21 and go get k8s.io/client-go go@1.20

What did you see happen?

not download compatible module version

What did you expect to see?

download compatible module version

@seankhliao seankhliao changed the title unexpected behavior: go get <module> go@<version> cmd/go: get doesn't select dependencies limited to go@version May 22, 2024
@seankhliao
Copy link
Member

cc @matloob @samthanawalla @hyangah

@seankhliao seankhliao added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. GoCommand cmd/go modules labels May 22, 2024
@thediveo
Copy link

the current behavior also breaks tools like go-mod-upgrade completely that use go get.

@matloob
Copy link
Contributor

matloob commented May 23, 2024

I can reproduce this. We should fix it. I'm not totally sure if it justifies getting in after the freeze or to be backported, but it might?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GoCommand cmd/go modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

4 participants