x/tools/imports: Process does not remove all unused imports sharing a package name #45398
Labels
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Tools
This label describes issues relating to any tools in the x/tools repository.
Milestone
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
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
errors
packages, 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?
Only one
errors
package is removed per iteration - seemingly always the last one to appear. Because we have three imported packages, we need to runimports.Process
three times to prune all the unused imports.Iteration 1:
Iteration 2:
Iteration 3:
The text was updated successfully, but these errors were encountered: