-
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
proposal: x/tools/cmd/goimports: add flag to remove blank lines in import for regrouping during formatting #64271
Comments
Yes pls, EZ 🍬
|
This is just what I want. |
win5do
pushed a commit
to win5do/tools
that referenced
this issue
Jan 11, 2025
Change https://go.dev/cl/641995 mentions this issue: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
current
The goimports will retain blank lines and multiple groups will exist after formatting.
testdata in.go:
goimports -local go.pkg.com in.go
output:expect
Would like a tool to automate the removal of blank lines and regrouping.
Add a
-r
flag,goimports -r -local go.pkg.com in.go
output:implement
It's easy to implement, here's the pseudo-code:
No breaking changes, and even regrouping keeps compatibility with the original goimports rules.
We forked goimports in our internal project and added this feature so that if the proposal is accepted, I can submit a PR.
The text was updated successfully, but these errors were encountered: