-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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/imports: package in v2 module listed in go.mod is resolved to non-listed v1 #58382
Comments
See also #41800. |
I agree that #41800 is the same issue. At least here I'm providing a process that is more easily reproducible. |
Thank you for the simple example. Imports is getting the wrong version even with the v2 version both in the module cache and being required in go.mod. |
Change https://go.dev/cl/582557 mentions this issue: |
Hello! Any news for this issue? |
@Oxygels yes. We understand this bug, and are working on a holistic rewrite of goimports for performance and correctness. It will probably land in the coming months. |
is there any temporary workaround or solution that can be applied to mitigate the issue until the rewrite is implemented? |
As far as I'm aware, the only solution is to change the import that isn't working manually, @feranwq. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes
Issue is reproducible with the latest commit from the repository:
What did you do?
main.go
without incomplete imports.xurls
symbol is not linked to any declared imports.go.mod
to list dependencies. One module has major version 2:mvdan.cc/xurls/v2@v2.4.0
goimports
to fix importsWhat did you expect to see?
Imports fixed in
main.go
. In particular an import ofmvdan.cc/xurls/v2
.What did you see instead?
I get an import of
mvdan.cc/xurls
(which is v1 and a different API) instead ofmvdan.cc/xurls/v2
.As a result the code modified by the goimports doesn't compile.
The text was updated successfully, but these errors were encountered: