Skip to content
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: Process do not remove used but duplicated imports #55982

Closed
Antonboom opened this issue Oct 1, 2022 · 4 comments
Closed

x/tools/imports: Process do not remove used but duplicated imports #55982

Antonboom opened this issue Oct 1, 2022 · 4 comments
Assignees
Labels
FrozenDueToAge 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

Comments

@Antonboom
Copy link

What version of Go are you using (go version)?

$ go version
go version go1.19.1 darwin/arm64

Does this issue reproduce with the latest release?

Yes

What did you do?

https://go.dev/play/p/QEVFgl-HPhb

What did you expect to see?

import (
    "fmt"
)

For all cases.

What did you see instead?

import (
    "fmt"
)
import (
    "fmt"

    "fmt"
)
import (
    "fmt"

    "fmt"

    "fmt"
)
import (
    "fmt"

    "fmt"

    "fmt"
)

P.S. Related to #37689, because fix for my issue is to add import aliases.

@gopherbot gopherbot added the Tools This label describes issues relating to any tools in the x/tools repository. label Oct 1, 2022
@gopherbot gopherbot added this to the Unreleased milestone Oct 1, 2022
@dmitshur dmitshur added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Oct 1, 2022
@dmitshur
Copy link
Contributor

dmitshur commented Oct 1, 2022

This looks related to but not the same as #45398.

CC @golang/tools-team.

@findleyr
Copy link
Contributor

I don't think this is related to #45398. The issue here is that these are in multiple import groups, and goimports (as a principle) processes import groups separately.

Note that if the duplicate imports are in the same group (as below) they are cleaned up as expected (as below):

import (
	"fmt"
	"fmt"
)

CC @heschi to confirm that this is expected behavior.

@findleyr findleyr modified the milestones: Unreleased, Backlog Nov 10, 2022
@heschi
Copy link
Contributor

heschi commented Nov 11, 2022

Correct AFAIK.

@findleyr
Copy link
Contributor

Thanks. Closing this as WAI.

@findleyr findleyr closed this as not planned Won't fix, can't repro, duplicate, stale Nov 14, 2022
@golang golang locked and limited conversation to collaborators Nov 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge 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.
Projects
None yet
Development

No branches or pull requests

5 participants