-
Notifications
You must be signed in to change notification settings - Fork 2.2k
chore: Format code with golangci-lint fmt
#3949
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
chore: Format code with golangci-lint fmt
#3949
Conversation
|
@alexandear - Genius. Very good idea. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3949 +/- ##
=======================================
Coverage 92.45% 92.45%
=======================================
Files 203 203
Lines 14980 14980
=======================================
Hits 13850 13850
Misses 927 927
Partials 203 203 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
gmlewis
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I may be an old-school Go developer, but I much prefer the grouping of all external imports into a single sorted bunch so that I don't have to visually search multiple bunches to find what I'm looking for.
Is there any way to give the new formatter a flag that preserves this "feature" (in my humble opinion)?
|
@gmlewis - I can answer that. Yes, the tool absolutely supports the "Old School" grouping you prefer (Single sorted bunch for all non-standard imports). Currently, the config defines 3 sections, which forces the split you're seeing: standard The Config Fix (.golangci.yml): linters-settings: |
|
@gmlewis reverted. By default, |
golangci-lint fmt
gmlewis
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, @alexandear and @merchantmoh-debug!
LGTM.
Merging.
script/fmt.shto use thegolangci-lint fmtcommand. Internally, it usesgofmt,gci,gofumpt,goimportssimultaneously.gci.sections,gofumpt.extra-rulesin golangci-lint config and reformat examples.Inspired by discussion comments in #3938.