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

Use GOTOOLCHAIN=auto in gopls update logic #3430

Closed
findleyr opened this issue Jun 22, 2024 · 3 comments
Closed

Use GOTOOLCHAIN=auto in gopls update logic #3430

findleyr opened this issue Jun 22, 2024 · 3 comments
Labels
gopls gopls related issues
Milestone

Comments

@findleyr
Copy link
Contributor

Add described in golang/go#65917, once Go 1.23 is out we plan to update the gopls go.mod file to say go 1.23.0, meaning that building gopls will require a 1.23 toolchain. Thanks to toolchain upgrades, this will be handled automatically for most users of Go 1.21+.

However, a concern raised on that issue is that some users have GOTOOLCHAIN=local set in their Go environment. Notably, this is set by default in some Linux distributions, such as Fedora.

I believe we are adding knowledge of gopls' build matrix into VS Code. We should also consider the value of go env GOTOOLCHAIN. If local, and the Go version is less than the required build version, we have two options:

  1. Install gopls with an explicit GOTOOLCHAIN=auto.
  2. Don't install gopls, and warn the user that they must install gopls manually or set GOTOOLCHAIN=auto in their VS Code environment.

I think 2 is best. If the user (or distro) has set GOTOOLCHAIN=local, I think we should treat that as a statement that they don't want toolchain upgrades. On the other hand, it seems likely that most users in this scenario are unaware that their distro has this default, and so by failing to upgrade gopls we are causing additional work for them. Nevertheless, (2) seems most conservative, and once users have updated their environment the upgrades will proceed normally in the future.

Another concern is that users may have set GOTOOLCHAIN=local because they don't want go list (implicitly run by gopls) to install toolchains. If we do decide to go with route (1), it should only be for the gopls install, not for the gopls session.

@gopherbot gopherbot added this to the Untriaged milestone Jun 22, 2024
@findleyr findleyr modified the milestones: Untriaged, v0.43.0, v0.42.0 Jun 22, 2024
@findleyr
Copy link
Contributor Author

@hyangah I put this in the v0.42 milestone, but the goal should just be to land this by mid-august, when we plan the gopls@v0.17.0 release. Please re-milestone as appropriate.

@ansaba ansaba added the gopls gopls related issues label Jun 27, 2024
@findleyr findleyr changed the title Add handling for GOTOOLCHAIN=local in gopls update logic Use GOTOOLCHAIN=auto in gopls update logic Jun 27, 2024
@findleyr
Copy link
Contributor Author

Decision: VS Code is going to set GOTOOLCHAIN=auto so that the toolchain upgrades work as expected.

@gopherbot
Copy link
Collaborator

Change https://go.dev/cl/596315 mentions this issue: extension/src/goEnv: set GOTOOLCHAIN=auto by default

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gopls gopls related issues
Projects
None yet
Development

No branches or pull requests

3 participants