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

go run not adhering to toolchain of go.mod when specifying package version #69817

Closed
wiegell opened this issue Oct 8, 2024 · 2 comments
Closed

Comments

@wiegell
Copy link

wiegell commented Oct 8, 2024

Go version

1.22.4

Output of go env in your module/workspace:

GO111MODULE=''
GOARCH='arm64'
GOBIN=''
GOCACHE='/root/.cache/go-build'
GOENV='/root/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.23.2.linux-arm64'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='local+auto'
GOTOOLDIR='/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.23.2.linux-arm64/pkg/tool/linux_arm64'
GOVCS=''
GOVERSION='go1.23.2'
GODEBUG=''
GOTELEMETRY='local'
GOTELEMETRYDIR='/root/.config/go/telemetry'
GCCGO='gccgo'
GOARM64='v8.0'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/goproject/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 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build3051749255=/tmp/go-build -gno-record-gcc-switches'

What did you do?

minimal repro repo (run execute_run_commands.sh):
https://github.com/wiegell/go-toolchain-repro

The local go version is 1.22.4, but github.com/99designs/gqlgen@v0.17.55 requires minimum 1.22.5. The local module is expecting 1.23.2 (in the local go.mod).
I am then using go run with a specific version of the package to run, like this: go run github.com/99designs/gqlgen@v0.17.55 generate.

What did you see happen?

When you do the above, you see the toolchain switch to go1.22.8.

What did you expect to see?

I would expect the version specific run command to adhere to the toolchain of the current module, like it does if i do the run command without a specific version: go run github.com/99designs/gqlgen generate (like this the toolchain will be go1.23.2)
Even though it's the same version of gqlgen being run, the toolchain differs.
You can see the difference by running the script in the repro repo.

Might be related to #69051

@seankhliao
Copy link
Member

The @version syntax explicitly runs as outside the scope of the current module, so this is just #69051

@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants