-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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: gopls.gc_details back doesn't clear all gc details #42198
Comments
cc @pjweinb |
I have reproduced this: I'm using the latest gopls and the latest vscod-go and the latest code-insiders. |
There are two ways of computing diagnostics, controlled by a boolean 'withAnalysis'. If a file is open in the editor, its (package's) diagnostics are computed withAnalysis true. So in this case, diagnostics for net/http are computed withAnalysis true. The details are computed for the directory net/http, but include details for net/dial.go, but as all the diagnostics for net/http are packaged together, these count as having withAnalysis true also. Then when gc_details is turned off, the diagnostics are recomputed, and there are none for net/dial.go. But gopls sees that the previous diagnostics for net/dial.go were done withAnalysis true, so it believes the new diagnostics are less precise, so doesn't send them. That is, the diagnostics for net/dial.go were sent originally as part of diagnostics on a different package (http, which has a visible file) and withAnalysis true, and the new diagnostics are on package net where withAnalysis is false. If this is right, the problem occurs when gc_detaills is turned off. There seem to be two approaches: |
Alas, it is harder than that. B doesn't work easily as we need to get empty diagnostics sent. Changing the remembered diagnostics doesn't help enough. And it's even worse: in the current source distribution gc_details also creates a diagnostic for vendor/golang.org/x/net/http/httproxy/proxy.go, and the regular diagnostics never produce anything for that, not even empty diagnostics, so there's no way to turn them off in vscode. |
Change https://golang.org/cl/266342 mentions this issue: |
there are other cases where the details don't go away. |
Change https://golang.org/cl/268464 mentions this issue: |
Change https://golang.org/cl/269320 mentions this issue: |
Change https://golang.org/cl/269677 mentions this issue: |
How to reproduce (using vscode)
Note: gopls is reporting gc details not only on the package
net/http
but also other packages it depends on.Note: gopls is reporting updated diagnostics on
net/http
, but this time, it doesn't send updated diagnostics on other packages.First `gopls.gc_details` with `net/http/server_test.go`
Second `gopls.gc_details` with `net/http/server_test.go`
What you expected
All gc details reports are cleared
What you see instead

All diagnostics from the package that I have a file open is gone, but everal gc details messages about other packages are still left over.
As soon as I opened the file by clicking one of the left-over gc details diagnostic messages, the left-over gc details on the package disappeared.
Extra info
go version: tip
gopls: v0.5.2-pre.1
The text was updated successfully, but these errors were encountered: