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.
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.
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.