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: redundant import name added #35397
Comments
Thank you for filing a gopls issue! Please take a look at the Troubleshooting guide, and make sure that you have provided all of the relevant information here. |
Change https://golang.org/cl/205657 mentions this issue: |
Silly mistake, thanks for the report. Why do you say that |
In this case I happen to know that I'm getting completions from the package of the function parameter (i.e. "context"), so there is only one possibility. But you bring up a good point that there is no existing import so the user normally can't/won't know where the candidates are coming from. |
That would be true in some cases, but not this one. context.Context is an interface, so I was also getting completions from x/net/context, for example. I think it's probably healthy to show it unconditionally, FWIW. |
Change https://golang.org/cl/205738 mentions this issue: |
In CL 205501 I thoughtlessly set import name to package name, but really we only want to name imports when goimports would do it. For now, it's better to not name them and let the usual imports code add a name if necessary. Fixes golang/go#35397. Change-Id: Id0df866f95e5e86ed72b25fbd1a7224c79ee8084 Reviewed-on: https://go-review.googlesource.com/c/tools/+/205657 Run-TryBot: Heschi Kreinick <heschi@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Rebecca Stambler <rstambler@golang.org> (cherry picked from commit c2ac6c2) Reviewed-on: https://go-review.googlesource.com/c/tools/+/205738 Reviewed-by: Heschi Kreinick <heschi@google.com>
Steps to reproduce:
Starting with:
CommandContext(<>)
and select "context.Background""context"
, but I getcontext "context"
(redundant alias).Also note that it says
from "context"
in the candidate description although it is not required in this case./cc @stamblerre @heschik
The text was updated successfully, but these errors were encountered: