-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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: symbol definitions not found after latest vscode/gopls upgrade #66677
Comments
Hi Eli, thanks for filing. I can reproduce this by installing gopls with go 1.21, and it is fixed by installing gopls with go 1.22. I believe VS Code should have prompted to reinstall tools upon the version mismatch, but it didn't, for me (CC @hyangah). I'm haven't yet investigated the failure mode, which is rather disconcerting: no errors, just a broken experience. |
This is a manifestation of #66525: (1) go/types fails fast with an error when the language version is newer than its runtime version, and (2) this error is not reported through the error handler, therefore not seen by gopls. Hence the silent brokenness of your workspace: go list happily lists packages and gopls happily type checks them, but they are empty. We need to guard against this when built with 1.21.x, since this is a very bad failure mode. We should capture a synthetic type checking diagnostic, and unset types.Config.GoVersion to proceed with type checking. |
Thanks for the quick response, @findleyr Indeed, removing |
@findleyr About the prompt for tools update not showing up - do you happen to have 'go.toolsManagement.autoUpdate' set? I just tested it with the default setting ( If the setting is 'true', the extension tries to rebuild and restart gopls without prompt, but, sadly, due to the issue like golang/vscode-go#3168, |
@hyangah -- I'm sorry: I just tried again and got the popup (but it went away after ~10s). I must have missed it. |
Change https://go.dev/cl/576678 mentions this issue: |
Change https://go.dev/cl/577302 mentions this issue: |
…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
What did you do?
Clone a github repo, e.g. https://github.com/eliben/gemini-cli
$ cd gemini-cli
$ code .
Navigate to
main.go
and click "Go to definition" on theExecute
symbol on line 10What did you expect to see?
Expected to jump to definition.
What did you see instead?
"No definition found for
Execute
" popupBuild info
This happened today, after an auto-upgrade of vscode.
I don't see errors in the
gopls (server)
in the Output terminal. Extension Host terminal says:The text was updated successfully, but these errors were encountered: