Skip to content

extension crashes if go.mod uses language version and the local go version is older than the go version in go.mod #3317

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

Open
hyangah opened this issue Apr 5, 2024 · 8 comments
Assignees
Milestone

Comments

@hyangah
Copy link
Contributor

hyangah commented Apr 5, 2024

Repro case:

$ GOTOOLCHAIN=local go version
go1.21.9
$ cat go.mod
module w

go 1.22

Screenshot 2024-04-05 at 3 41 23 PM

Failed to run '/usr/local/go/bin/go env' (cwd: /Users/hakim/projects/go-qrcode): Error: Command failed: /usr/local/go/bin/go env -json GOPATH GOROOT GOPROXY GOBIN GOMODCACHE
go: downloading go1.22 (darwin/amd64)
go: download go1.22 for darwin/amd64: toolchain not available

go: downloading go1.22 (darwin/amd64)
go: download go1.22 for darwin/amd64: toolchain not available

The root cause is
golang/go#65580
that was closed as a duplicate of golang/go#62278,
which was closed in favor of a better error message.

cc @golang/tools-team

@gopherbot gopherbot added this to the Untriaged milestone Apr 5, 2024
@hyangah hyangah modified the milestones: Untriaged, v0.41.3 Apr 6, 2024
@hyangah hyangah self-assigned this Apr 6, 2024
@hyangah hyangah modified the milestones: v0.41.3, v0.42.0 Apr 19, 2024
@rhcarvalho
Copy link

I'm seeing a similar problem, but go.work instead of go.mod. I believe the underlying problem to be the same.

Error loading workspace: packages.Load error: err: exit status 1: stderr: go: go.work requires go >= 1.22.3 (running go 1.22.2)

Running go version on the integrated terminal gives:

go version go1.22.3 linux/amd64

Thus the go1.22.2 toolchain was able to download and use the go1.22.3 toolchain, but gopls doesn't pick it up.

@matloob
Copy link

matloob commented May 28, 2024

@hyangah We expect this to be fixed once 1.21.11 is released with the backported change to download 1.22.0 when 1.22 is listed in go.mod, right?

@hyangah hyangah modified the milestones: v0.42.0, v0.43.0 Jul 15, 2024
@hyangah hyangah modified the milestones: v0.43.0, v0.44.0 Aug 30, 2024
@hyangah hyangah modified the milestones: v0.44.0, v0.46.0 Dec 9, 2024
@h9jiang h9jiang modified the milestones: v0.46.0, v0.48.0 Mar 4, 2025
@heppu
Copy link

heppu commented Mar 14, 2025

Still running in to this issue:

Error loading workspace: packages.Load error: err: exit status 1: stderr: go: go.work requires go >= 1.24.1 (running go 1.23.6)

I don't understand where that go 1.23.6 version is coming from.

$ go version                
go version go1.24.1 linux/amd64

go.work

go 1.24.1

toolchain go1.24.1

@delca85
Copy link

delca85 commented Mar 14, 2025

@heppu which is the IDE you are working? I managed to fix this manually selecting the go version used by VSCode (even if the IDE was already showing Go 1.24.1 as used version).

@heppu
Copy link

heppu commented Mar 14, 2025

I'm using vscode-insider. I think this is gopls issue. I can see that gopls is build with 1.23.6 toolchain:

## Tools
	go:	/usr/bin/go: go version go1.24.0 linux/amd64
	gopls:	/home/heppu/go/bin/gopls	(version: v0.18.1 built with go: go1.23.6)
	gotests:	/home/heppu/go/bin/gotests	(version: v1.6.0 built with go: go1.24.0)
	gomodifytags:	/home/heppu/go/bin/gomodifytags	(version: v1.17.0 built with go: go1.24.0)
	impl:	/home/heppu/go/bin/impl	(version: v1.4.0 built with go: go1.24.0)
	goplay:	/home/heppu/go/bin/goplay	(version: v1.0.0 built with go: go1.24.0)
	dlv:	/home/heppu/go/bin/dlv	(version: v1.24.1 built with go: go1.24.0)
	golangci-lint:	/home/heppu/go/bin/golangci-lint	(version: v1.64.6 built with go: go1.24.0)

@heppu
Copy link

heppu commented Mar 14, 2025

Building gopls from master with go1.24.1 seemed to fix this issue.

EDIT: I was to quick, it didn't fix the issue.

@bweston92
Copy link

@heppu did you manage to find a fix?

@heppu
Copy link

heppu commented Mar 31, 2025

@bweston92 Nope but I think there was a gopls ticket when I was googling about it.

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

8 participants