/ go Public
x/tools/imports: Process does not remove all unused imports sharing a package name #45398
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
This label describes issues relating to any tools in the x/tools repository.
What version of Go are you using (
Does this issue reproduce with the latest release?
What did you do?
See https://play.golang.org/p/yv78HSm0AX6 for a full example, and https://play.golang.org/p/GmUF-tayOgI for an interactive example (hit "Format" with imports enabled).
What did you expect to see?
This file has three imported
errorspackages, none of them are referenced outside of the import block, so they should all be removed, resulting in this output:
What did you see instead?
errorspackage is removed per iteration - seemingly always the last one to appear. Because we have three imported packages, we need to run
imports.Processthree times to prune all the unused imports.
The text was updated successfully, but these errors were encountered: