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: errors in go.mod file prevents initial workspace load #36531
Comments
Thank you for filing a gopls issue! Please take a look at the Troubleshooting guide, and make sure that you have provided all of the relevant information here. |
There is another place where the error message should be checked if it is related to a go.mod parse error: internal/lsp/cache/load.go#L72. Adding the same check as on internal/lsp/cache/builtin.go#L40 here would cause the go.mod error to show up on initial load of the workspace. However, even after the error is addressed and the go.mod file is saved, gopls does not seem to call packages.load again and the error diagnostic does not disappear from the go.mod file. |
As a follow-up to https://golang.org/cl/214417, I will look into making one |
Change https://golang.org/cl/214877 mentions this issue: |
This change combines the two packages.Load calls that happen on view creation. Builtins can be loaded along with the rest of the workspace. To avoid race conditions, create a builtinPackageHandle type for builtins and use it to create the data. Updates golang/go#36531 Change-Id: I7aa342c463a0b7718e1ad5fee507622310d8443b Reviewed-on: https://go-review.googlesource.com/c/tools/+/214877 Run-TryBot: Rebecca Stambler <rstambler@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Heschi Kreinick <heschi@google.com>
Now that the above CL has been merged, the main question remains: How should The problem is that we don't want to keep trying to initialize if it keeps failing. I propose that, if we have an initialization error, we retry after every change to the |
Yeah, I think that approach works, since we will be able to surface go.mod errors even when the initial workspace load breaks. |
Change https://golang.org/cl/216037 mentions this issue: |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What did you do?
What did you expect to see?
I expected the go.mod error to surface with the initial workspace load.
What did you see instead?
I saw that gopls logged the error due to the initial call packages.load call when the view is created. However, since there was an error with that initial load all the LSP features break. The error shows up once you save a .go file or start making edits in the go.mod file.
/cc @stamblerre
The text was updated successfully, but these errors were encountered: