-
Notifications
You must be signed in to change notification settings - Fork 17.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
x/tools/cmd/goimports: -local adds local packages before external packages #31646
Comments
This seems arbitrary either way, no? It chose something, so that should be fine, just like the rest of the spirit of gofmt? |
Help message said "put imports beginning with this string after 3rd-party packages; comma-separated list" though. Also if the import block is import (
"fmt"
"github.com/cespare/wait"
) , then import (
"fmt"
"github.com/cespare/wait"
"liftoff/go/timeutil"
) |
Okay, if it contradicts the docs, that might be reason enough to change it. I don't object if you send a CL. Others might argue it's better to fix the docs, but I'll let them make that case if so. |
We're seeing this as well. Our CI catches badly formatted imports and they've been failing recently, even though everyone has setup filewatchers in Goland with the Specifically,
|
@af-engineering for Goland you can fix that by using goland settings https://youtrack.jetbrains.com/issue/GO-7321 |
Looked into this a bit since I tripped over this as well. The fundamental issue here seems to be that goimports doesn't reorder existing imports across empty lines (only if there are e.g. external and local imports in the same "group", additional empty lines are inserted). This is also explicitly tested against in |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Use
goimports
to add missingtimeutil
import, which is our local package.What did you expect to see?
What did you see instead?
The text was updated successfully, but these errors were encountered: