Include https://github.com/mvdan/gofumpt in set of linters.
Hi, nice tool, thank you!
Pull requests are welcome
Given gofumpt/gofumports does everything that gofmt / goimports would do, what is the preference for applying this?
Enforce a stricter format than
gofmt, while being backwards compatible. That is,gofumptis happy with a subset of the formats thatgofmtis happy with.
The tool is a modified fork ofgofmt, so it can be used as a drop-in replacement. Runninggofmtaftergofumptshould be a no-op.
Would gofumpt (and gofumports) be added as an entirely new linter, or options for gofmt/goimports ?
Hey there, I'm also interested in adding gofumpt/goimports.
Would gofumpt (and gofumports) be added as an entirely new linter, or options for gofmt/goimports ?
About new linter vs gofmt option is see pros and cons:
Hey, sorry for long responses, we are currently trying to deal with bugs and preparing to go1.14, so very low of capacity.
I'm also not sure how to deal with linters that superset other linters, e.g. we can't just auto-ignore them.
Maybe we can just start adding it as a new linter and disable gofmt/goimports manually.
I created a PR for it: https://github.com/golangci/golangci-lint/pull/1177
@teivah thanks for working on the PR, pleased to see that it was merged
A quick scan of the PR suggests it doesn't currently map the golangci-lint "Autofix" functionality to a gofumpt -s -w equivalent, like it does for the gofmt linter. It would be good if that could be added, as then we could switch our .golanci-lint.yml to disable the fmt linter and switch to gofumpt wholesale
cc @mvdan as he'd probably be interested in knowing that this work is taking place to add gofumpt to golangci-lint
Since gofump returns already formatted file instead of diff, so we need to use something like this https://github.com/sergi/go-diff library to create a diff then use extractIssuesFromPatch function
@dnwe Could you please test the #1239 ?
This has been added in #1177.
@invidian you are right, the gofumpt linter was added in that PR, but it doesn't support autofixing, I'm adding it in the #1239
@SVilgelm, hello!
Could you tell me something about this?
https://github.com/mvdan/gofumpt/issues/79
@Antonboom latest master has an updated version of gofumpt and it works correctly for the example you provided.
The PR with the update: #1228
Then I have to wait v1.28.4
Thanks!
Most helpful comment
@teivah thanks for working on the PR, pleased to see that it was merged
A quick scan of the PR suggests it doesn't currently map the golangci-lint "Autofix" functionality to a
gofumpt -s -wequivalent, like it does for thegofmtlinter. It would be good if that could be added, as then we could switch our .golanci-lint.yml to disable the fmt linter and switch to gofumpt wholesalecc @mvdan as he'd probably be interested in knowing that this work is taking place to add gofumpt to golangci-lint