You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The text was updated successfully, but these errors were encountered:
josharian
changed the title
goimports keeps repeated import if there is a blank line between them
go/format: repeated import remains if there is a blank line between them
Feb 27, 2015
Thanks for the report. I think that this is working as intended. Within a run of non-space-separated imports, go/format and goimports both sort and deduplicate. They do no sorting (and consequently no deduplication) across groups or blank lines. This leaves some amount of control to decide how to organize your imports. This is particularly important with magic imports such as used by cgo. If we were to rearrange all imports at will, that would prevent third parties from implementing a tool such as cgo, which would be a pity.
For instance, goimports transforms [1] into [2], but keep [3] as it is.
1:
2:
3:
The text was updated successfully, but these errors were encountered: