-
Notifications
You must be signed in to change notification settings - Fork 18k
x/tools/gopls: automatic imports sometimes pick non-optimal modules #60663
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
Related to this — is it possible to configure the import-suggester to never suggest certain packages? I read the settings documentation and could not find a relevant setting, but I am not confident I'm looking for the right term. Between vscode settings, lsp settings, and the formatter (gofumpt is what I think I'm using?) I also don't know where this setting should exist. |
Thanks for the report. I'm collecting goimports related issues into a |
Hi. I failed to reproduce this behavior. I did 'git clone https://github.com/coreos/go-oidc.git', created a file in the same directory as the .git file with 'package main; const y = idc.ScopeOpenID' and saved the file. gopls inserted 'import "github.com/coreos/go-oidc/v3/oidc"' which I think is the right answer. Running go mod tidy before or after didn't seem to make any difference. I'm using gopls v0.15.2. Does the error still happen for you? |
Thank you. I see it too. |
Would be really great to get this fixed. Quite annoying when it strikes. |
I see what is going wrong. But I don't yet know how to fix it without
breaking other things.
…On Fri, Mar 22, 2024 at 4:29 PM andig ***@***.***> wrote:
Would be really great to get this fixed. Quite annoying when it strikes.
—
Reply to this email directly, view it on GitHub
<#60663 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABJIAI7XEQZVP3W5IIMLCVTYZSIBNAVCNFSM6AAAAAAY6DV642VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMJVHA2TSMZSGU>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Change https://go.dev/cl/582557 mentions this issue: |
Thank you @pjweinb ! |
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?
oidc.ScopeOpenID
constantWhat did you expect to see?
Package "github.com/coreos/v3/go-oidc/oidc" imported by gopls
What did you see instead?
Package "github.com/coreos/go-oidc" imported by gopls
I would have expected the already-imported package to be used, instead gopls seems to pick any package that it might find suitable.
/cc @adonovan
The text was updated successfully, but these errors were encountered: