-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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: should suppress diagnostics when GOMODCACHE is under the repo root #51947
Comments
@pjweinb @peterldowns Signed shift count is indeed a language change introduced in go1.13 but On the other hand, according to the original proposal, this is a backwards compatible change and @peterldowns Were you browsing the source code or directory of |
@hyangah I believe this is actually a bug in go/types, when used with -lang < 1.13. |
@hyangah thank you for the quick response, it's kind of you to help me triage this.
I was not browsing the source code or directory of
and the
and I see that the iota types are being correctly ignored, with log output like:
but no entries in the Problems tab. The issue is that if I open just the backend directory in VSCode, with
but no messages about falling back to safe trimming for the packages that are reporting errors in the Problem view. If I add a
then
and I see messages about falling back to safe trimming
|
@hyangah these diagnostics are reported for packages outside of the workspace because they are type-checker errors on package-level declarations, which must type-check. The fundamental problem here is not gopls, but that there is a bug in go/types that was only recently exposed when gopls started setting Sorry for the breakage, and thank you for the diligent report. It may have been some time before we noticed this bug. |
Thanks for the quick fix @findleyr and thanks @peterldowns for sharing the details.
@findleyr that is different from what I observe - you can quickly check it from x/tools/gopls/internal/regtest/misc/import_test.go that depends on BTW the title of the issue and the issue we've discussed so far don't match. |
Indeed you are right. @peterldowns where is your
Yes, the issue @pjweinb reports is related to noise in the logs, not noise in the diagnostics. The root cause of the noise he reported is the same, however. |
From the terminal output above,
We do not set this environment variable explicitly, we just set |
One fact that I'll highlight is that adding the
Again, sorry for not providing a more minimal repro. If you need any new information, please let me know, and I will try to find time to come up with a minimal repro if it helps. |
@peterldowns thanks (and sorry, I missed that your go env was in the logs). Gopls is not suppressing diagnostics because GOMODCACHE is under the repo root, even though it is not included in the workspace. We should fix this. |
Strangely, it is suppressing the diagnostics when vscode is launched in the repo root, just not when vscode is launched in the backend subdirectory. I realize the paths and the language I'm using here are confusing, so here is my best attempt at a minimal-case reproduction of the issue I've been encountering, including instructions on how to attempt the repro, a nix-shell config for getting the correct versions of go and gopls, and screenshots of the problems. https://github.com/peterldowns/gopls-repro-example I am happy to file a bug report separately from this thread if my issue is unrelated. Lastly, THANK YOU for helping triage this issue and for your patience with my imprecise language. I am not very familiar with the go1.18 workspace concepts, gopls, or how vscode plays into all this. I rely every day on the work you and your fellow maintainers do to make Go great and extremely usable. Thank you very much 🙇 |
Change https://go.dev/cl/431836 mentions this issue: |
This log is noisy and of little value, often confusing users. Remove it. Updates golang/go#51947 Change-Id: I2b2dff8383de52467bf3953d3efda4e6d4b792dd Reviewed-on: https://go-review.googlesource.com/c/tools/+/431836 Reviewed-by: Heschi Kreinick <heschi@google.com> gopls-CI: kokoro <noreply+kokoro@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Robert Findley <rfindley@google.com>
There were three bugs here:
I'm going to repurpose this issue for the third item, and assign it to Rob since it's a metadata issue, and he's the expert on that. |
Although running go 1.18, gopls shows error messages like:
2022/03/25 17:19:07 falling back to safe trimming due to type errors: [/usr/local/google/home/pjw/go/pkg/mod/github.com/google/go-cmp@v0.5.7/cmp/options.go:469:24: invalid operation: signed shift count iota (untyped int constant 0) requires go1.13 or later
These are misleading (go1.13?) and unhelpful
The text was updated successfully, but these errors were encountered: