mirror of
https://github.com/golang/go
synced 2024-11-19 00:54:42 -07:00
ea4142463b
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 <suzmue@golang.org> Reviewed-by: Heschi Kreinick <heschi@google.com> |
||
---|---|---|
.. | ||
apidiff | ||
fastwalk | ||
gopathwalk | ||
imports | ||
jsonrpc2 | ||
lsp | ||
memoize | ||
module | ||
semver | ||
span | ||
tool | ||
txtar | ||
xcontext |