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
Instead of adding the new import path to the existing block of external code, a new block is created. This only seems to happen if the added import path is from a domain not yet present in the existing external block. This seems weird as goimports itself adds them together if they weren't present.
So my question, is this the expected behavior for goimports or is this a bug? If it's confirmed a bug I may take a shot at creating a CL to fix it.
The text was updated successfully, but these errors were encountered:
Having the following files inside
$GOPATH/src
:And the
bar.go
file containing:Running
goimports -d github.com/foo/bar
results in:This seems like the correct thing to do according to https://github.com/golang/go/wiki/CodeReviewComments#imports, adding a single new import block for external code.
However if we change the
bar.go
file to:And execute
goimports -d github.com/foo/bar
again, the result is quite different:Instead of adding the new import path to the existing block of external code, a new block is created. This only seems to happen if the added import path is from a domain not yet present in the existing external block. This seems weird as goimports itself adds them together if they weren't present.
So my question, is this the expected behavior for goimports or is this a bug? If it's confirmed a bug I may take a shot at creating a CL to fix it.
The text was updated successfully, but these errors were encountered: