Enhance goimports
linter to support opinionated go import statements
#3362
Labels
goimports
linter to support opinionated go import statements
#3362
Your feature request related to a problem? Please describe.
This is a proposal to enhance the
goimports
linter to provide opinionated go import formatting rules. The linter could:Issue 20818 is still in ideation stage, but there is already a concrete implementation: https://github.com/rinchsan/gosimports is effectively a drop-in replacement for the
goimport
command, with additional opinionated rules to group/order go import statements.Describe the solution you'd like.
I can see two ways to implement this proposal:
gosimport
instead ofgoimport
.goimports
linter. The setting would be used to control which command to use, e.g. goimport or gosimport.Option 2 seems to be better for users of the
golangci-lint
tool. There would be one linter to control go import formatting rules, one place to document what the formatting rules are. Also, it seems fairly straightforward to modify https://github.com/golangci/gofmt/tree/master/goimports to support eithergosimport
orgoimport
.Describe alternatives you've considered.
This is a new feature. I'm not aware of the ability to control which go import formatting tool can be used.
Additional context.
Assuming the
-local
argument is the same forgoimport
andgosimport
:gosimport
command may reformat code that was previously formatted withgoimport
.goimport
command does not reformat code that was previously formatted withgosimport
.The text was updated successfully, but these errors were encountered: