-
Notifications
You must be signed in to change notification settings - Fork 18k
x/tools/gopls: compiler errors disappearing and reappearing in unopened test files #38267
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
Comments
Thanks for the issue report and the log! Some quick observations:
From this information, my first guess is that this is an issue with diagnostics caching, since the file is not changing, but the diagnostics are seemingly changing and being resent. I'll see if I can come up with a regression test for this case. A question for you: Were the diagnostics ever correct? Are the analysis diagnostics accurate or are they also outdated? |
I restarted
I'm not sure which diagnostics you mean, sorry. Do you mean the "cannot use" ones? I don't think those were correct; the package builds and I can edit the file without trouble.
Which diagnostics are the analysis ones? Most (if not all) of the warnings are from golangci-lint (as I don't run staticcheck live). I'll have to disable it to get a better view on things, since all of these tools display their diagnostics with the underlying tool's/analysis' names. I know that this project has a bunch of places without The repro is this repo on the selected branch, if you want to test this more easily: https://github.com/zikaeroh/sqlboiler/tree/with-gomod |
Thanks for sharing the repro - I didn't realize it repro'd this easily. I should be able to make some progress off of the repro. Edit: This does not reproduce with |
I'm assuming that's a note to self, given I'm running at the current master build and not 0.3.4 (so probably something in between). 🙂 |
Yep 😄Sorry about that - just wanted to take notes as I investigate. I think I've isolated this to some weirdness with the new |
Change https://golang.org/cl/227299 mentions this issue: |
FWIW I'm also seeing instances of the "cannot use &(X literal) (value of type *X) as *X value in assignment" with @stamblerre - do you have enough information here or would you like further log files? |
Can you try patching in https://golang.org/cl/227299 and seeing if that fixes the issue? |
The code for `gofmt -s` directly modifies the AST, since the ASTs are not long-lived. Some of this code made it into our analysis implementations, causing very strange bugs to manifest. Added a regression test for this specific case. Fixes golang/go#38267 Change-Id: I4c90cbd686f5e7e635a94abe40463feb5911fa2d
Change https://golang.org/cl/227354 mentions this issue: |
Fixed it for me, thank you! |
The code for `gofmt -s` directly modifies the AST, since the ASTs are not long-lived. Some of this code made it into our analysis implementations, causing very strange bugs to manifest. Added a regression test for this specific case. Fixes golang/go#38267 Change-Id: I235620adcbf2bbc7027c6d83ff2c7fe74729062e Reviewed-on: https://go-review.googlesource.com/c/tools/+/227299 Run-TryBot: Rebecca Stambler <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Heschi Kreinick <[email protected]> (cherry picked from commit 1fd9766) Reviewed-on: https://go-review.googlesource.com/c/tools/+/227354 Reviewed-by: Robert Findley <[email protected]>
I didn't have a repro in this case, so totally happy to go with you and @zikaeroh on this one. Will open a new issue if I spot this again. |
Please answer these questions before submitting your issue. Thanks!
What did you do?
I was working on one file in a project that fully compiles and runs. I can publish it if needed.
What did you expect to see?
No errors; the code compiles.
What did you see instead?
Randomly, I'd see that one of the files had a bunch of compiler errors. But, I'd go open the file and they'd disappear. Close the file, and they'd come back. I could modify another file in the package and they'd disappear and come back some time in the future. This happens reliably in this project.
LSP logs: https://gist.github.com/zikaeroh/89ddc6f1b444b756cc44195f607481ad
Screenshots of what VS Code is showing me in one file, versus moving to the file with the errors:
Build info
Go info
The text was updated successfully, but these errors were encountered: