Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

How to make 1.22.9 workspaces work on Ubuntu 24.04 #3622

Unanswered
AndreasBergmeier6176 asked this question in Help
Discussion options

We have a workspace with multiple modules. All are defined as using golang 1.22.9.

Now in a module, the extension wants to analyze the encompassing workspace.
It seems to do this with the system Go toolchain :( (which is 1.22.2).
As a result it prints a lot of errors:

packages.Load error: err: exit status 1: stderr: go: go.work requires go >= 1.22.9 (running go 1.22.2)

What must I configure so that it uses another toolchain?

And by the way - is there a way of preventing/disallowing it to use the system Golang toolchain? It almost never is correct to use that.

You must be logged in to vote

Replies: 1 comment

Comment options

@AndreasBergmeier6176
I think I see what’s happening here. Your workspace is set up to use Go 1.22.9, but the extension is picking up the system-installed Go version 1.22.2, which is causing all these errors.

To fix this, you’ll want to make sure your environment is correctly set up so that the right Go version is used everywhere. A good way to do this is by setting GOTOOLCHAIN=local, which tells Go to always use the version specified in your workspace rather than falling back to the system toolchain. You can do this by running (from your workspace):

go env -w GOTOOLCHAIN=local

Or:

go env -w GOTOOLCHAIN=go1.22.9

Also, make sure your go.work file correctly specifies go 1.22.9, which I assume is already the case.

In VS Code, the extension might still be defaulting to the system Go installation. You can force it to use the correct version by setting the GOROOT path in the settings, or adding this to your settings.json:

"go.alternateTools": {
 "go": "/path/to/go1.22.9/bin/go"
}

That should sort it out. Let me know if it still gives you trouble

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /