-
-
Notifications
You must be signed in to change notification settings - Fork 114
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
group all standard library imports #8
Comments
Looks like this is being implemented in golang/go#20818. Since it's planned there, and since implementing this would be non-trivial, let's wait and see how that issue progresses. |
Hmm, if I do this only for standard library imports, that might be simple enough to implement on our side. |
I took a shot at this yesterday, but it's a nightmare to implement properly while keeping good position information. That is, without messing up empty lines or comments. |
I think gofumports only delete empty lines in imports. exec goimports after gofumports.
import (
"github.com/b/xxxx"
"context"
"time"
"github.com/a/xxx"
) import (
"github.com/b/xxxx"
"context"
"time"
"github.com/a/xxx"
)
import (
"context"
"time"
"github.com/a/xxx"
"github.com/b/xxxx"
) |
While that's an interesting idea, it wouldn't work; we'd also be clumping together non-std imports. For example, a common standard is to group together third-party imports by project or by purpose. |
The heuristic here was a bit lax; I've made it a bit more aggressive. See the commit pushed to master just above. |
I hope following code after gofumports.
The text was updated successfully, but these errors were encountered: