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: duplicate "undeclared name" errors following CL222237 #38136
Comments
I can't seem to reproduce this using VSCode or running gopls tests. They only seem to return a single undeclared diagnostic. Are you able to see what the source of the diagnostic is (ex. "compiler", "undeclaredname",...)? |
Apologies, I forgot to attach the |
Change https://golang.org/cl/226417 mentions this issue: |
@myitcv I created a test in https://golang.org/cl/226417 using Rob's regtest framework that does the same behavior as the vim test in question. It does not seem to be returning 2 diagnostics. From the
@stamblerre is this a |
@ridersofrohan - are the configurations identical, comparing your test with the |
@ridersofrohan: It looks like the ranges aren't the same for these errors - is that causing the problem, maybe? |
Change https://golang.org/cl/226777 mentions this issue: |
What's the status here @stamblerre - did you close this by accident? |
Nope - the above CL fixes the test. |
Ah sorry, I hadn't appreciated that. I saw:
and assumed there were further CLs to follow. |
Isn’t it easier to track progress if issues are closed after the CL is merged? |
Ah, sorry I see what you meant now - I have a couple of analysis-related CLs in flight right now, and I forgot which one I had merged. |
I see that https://go-review.googlesource.com/c/tools/+/226962 has actually fixed this. https://go-review.googlesource.com/c/tools/+/226777/ is not merged. |
Ah, ok since this is fixed I will close the issue. We'll re-enable these analyzers with |
This change is the first step in handling golang/go#38136. Instead of creating multiple diagnostic reports for type error analyzers, we add suggested fixes to the existing reports. To match the analyzers for FindAnalysisError, we add an ErrorMatch function to source.Analyzer. This is not an ideal solution, but it was the best one I could come up with without modifying the go/analysis API. analysisinternal could be used for this purpose, but it seemed to complicated to be worth it, and this is fairly simple. I think that go/analysis itself might need to be extended for type error analyzers, but these temporary measures will help us understand the kinds of features we need for type error analyzers. A follow-up CL might be to not add reports for type error analyzers until the end of source.Diagnostic, which would remove the need for the look-up. Fixes golang/go#38136 Change-Id: I25bc6396b09d49facecd918bf5591d2d5bdf1b3a Reviewed-on: https://go-review.googlesource.com/c/tools/+/226777 Run-TryBot: Rebecca Stambler <rstambler@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Heschi Kreinick <heschi@google.com>
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
As pointed out by @findleyr in govim/govim#832 (comment), we are seeing duplicate "undeclared name" errors from
gopls
, as highlighted by the followinggovim
test.The output from the test is:
What did you expect to see?
The test passing
What did you see instead?
The test failed, as above.
cc @stamblerre @ridersofrohan
FYI @leitzler
The text was updated successfully, but these errors were encountered: