forked from golang/tools
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
internal/imports: merge import declarations
When an import is added to the ast, the import declarations are merged together into the first import declaration. Since this is a part of the formatting functionality of goimports, do this during formatting regardless. The merging pass was added to astutil.AddNamedImport in order to address issue golang/go#14075. This joined imports from other blocks into the first import declaration, so that a single block of imports isn't split across multiple blocks. This functionality is more of a formatting change than a fix imports change, in line with sorting the imports, which occurs even when FormatOnly. The formatting was only applied when an import was added (not renamed or deleted). This change makes formatting by goimports more consistent across runs and is not dependent on the exact fixes that need to be applied. Change-Id: Icb90bf694ff35e2d6405a3d477cf82fcd3e697e0 Reviewed-on: https://go-review.googlesource.com/c/tools/+/189941 Run-TryBot: Suzy Mueller <[email protected]> Reviewed-by: Heschi Kreinick <[email protected]>
- Loading branch information
Showing
3 changed files
with
78 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters