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

x/tools/gopls: improve error message when user needs newer go version #61673

Closed
hyangah opened this issue Jul 31, 2023 · 4 comments
Closed

x/tools/gopls: improve error message when user needs newer go version #61673

hyangah opened this issue Jul 31, 2023 · 4 comments
Labels
gopls/metadata Issues related to metadata loading in gopls gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@hyangah
Copy link
Contributor

hyangah commented Jul 31, 2023

go version

go 1.21rc3
gopls v0.13.0

How to reproduce the issue

-- go.mod --
module example.com

go 1.23

And start gopls from this directory.

Screenshot 2023-07-31 at 12 42 10 PM

go1.23 is not available so this error is expected. (Users who have GOTOOLCHAIN=local env would experience similar issues). But the error message that references a temporary go.mod file can be potentially confusing for users. Either rewrite the error message or at least, replace the temporary go.mod file with the original go.mod file in the message.

And this diagnostic is attached to the "module" line. But for this specific error, I think the "go" line may be more suitable if feasible.

Screenshot 2023-07-31 at 12 45 43 PM

@gopherbot gopherbot added Tools This label describes issues relating to any tools in the x/tools repository. gopls Issues related to the Go language server, gopls. labels Jul 31, 2023
@gopherbot gopherbot added this to the Unreleased milestone Jul 31, 2023
@findleyr
Copy link
Member

I think we should no longer use a temp mod file in this case, since the go command should no longer mutate the mod file.

@findleyr findleyr modified the milestones: Unreleased, gopls/v0.14.0 Jul 31, 2023
@adonovan adonovan added the gopls/metadata Issues related to metadata loading in gopls label Aug 31, 2023
@findleyr findleyr modified the milestones: gopls/v0.14.0, gopls/v0.15.0 Oct 9, 2023
@findleyr findleyr modified the milestones: gopls/v0.15.0, gopls/v0.16.0 Feb 16, 2024
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/576678 mentions this issue: internal/check: filter out too-new Go versions for type checking

gopherbot pushed a commit to golang/tools that referenced this issue Apr 8, 2024
The type checker produces an error if the Go version is too new. When
compiled with Go 1.21, this error is silently dropped on the floor and
the type checked package is empty, due to golang/go##66525.

Guard against this very problematic failure mode by filtering out Go
versions that are too new. We should also produce a diagnostic, but that
is more complicated and covered by golang/go#61673.

Also: fix a bug where sandbox cleanup would fail due to being run with a
non-local toolchain.

Fixes golang/go#66677

Change-Id: Ia66f17c195382c9c55cf0ef883e898553ce950e3
Reviewed-on: https://go-review.googlesource.com/c/tools/+/576678
Reviewed-by: Alan Donovan <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/577302 mentions this issue: [gopls-release-branch.0.15] internal/check: filter out too-new Go versions for type checking

gopherbot pushed a commit to golang/tools that referenced this issue Apr 8, 2024
…sions for type checking

NOTE: Patched for the release branch to use versions.Compare rather than
versions.Before.

The type checker produces an error if the Go version is too new. When
compiled with Go 1.21, this error is silently dropped on the floor and
the type checked package is empty, due to golang/go##66525.

Guard against this very problematic failure mode by filtering out Go
versions that are too new. We should also produce a diagnostic, but that
is more complicated and covered by golang/go#61673.

Also: fix a bug where sandbox cleanup would fail due to being run with a
non-local toolchain.

Updates golang/go#66677
Updates golang/go#66730

Change-Id: Ia66f17c195382c9c55cf0ef883e898553ce950e3
Reviewed-on: https://go-review.googlesource.com/c/tools/+/576678
Reviewed-by: Alan Donovan <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>
(cherry picked from commit de6db98)
Reviewed-on: https://go-review.googlesource.com/c/tools/+/577302
@findleyr
Copy link
Member

As of https://go.dev/cl/579439 we no longer use a temp mod file for loads, so this error message should be improved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gopls/metadata Issues related to metadata loading in gopls gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

4 participants