x/tools/internal/imports: do not detach comments above a given import when merging #48688
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?
For example,
gets combined into:
Here you can see that the comments associated with each of the packages have been detached. This is especially problematic for the "C" package, which has lost its preamble entirely.
What did you expect to see?
For the above example:
where "C" remains detached, as given in func
mergeImports
, fileinternal/imports/sortimports.go
. In general, I don't see why it needs to remain detached, but I'm not suggesting that convention be changed.You could also write this without the line separations between "same host" packages, as below, though it doesn't read as clearly:
I would prefer the previous style where, in general, any package having an attached comment has one blank line of padding on top and bottom even if it is part of a "same host" package group.
The text was updated successfully, but these errors were encountered: