Closed eliben closed 6 months ago
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 gopls
and re-installing it with 1.22 solved the issue for me.
@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 ("go.toolsManagement.autoUpdate": false
) and got the following prompt.
If the setting is 'true', the extension tries to rebuild and restart gopls without prompt, but, sadly, due to the issue like https://github.com/golang/vscode-go/issues/3168, go install
runs with the system version of go (in this case 1.21.x). :-(
@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: internal/check: filter out too-new Go versions for type checking
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
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: