Replies: 4 comments 1 reply
-
|
Could we add a pre-commit hook, to lint and format using golang-ci and if there are changes abort the commit and ask commiter to confirm and re-commit? |
Beta Was this translation helpful? Give feedback.
-
|
I have very little opinion on what the formatter should be. My somewhat strong opinion is that this is not worth spending much time over. That, sort of, means defaulting to whatever is the language’s default — |
Beta Was this translation helpful? Give feedback.
-
|
We keep the vote open until the end of the week based on the discussion in the community meeting yesterday, we can then decide based on the final result next week. |
Beta Was this translation helpful? Give feedback.
-
|
gofumpt won, adding it in #27498 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Currently our repos are using different formatters, some are set to only use gofmt (official go formatter) while others enforce formatting via gofumpt (https://github.com/mvdan/gofumpt)
Buildah, common and storage modules are set to use gofumpt enforced via the golangci-lint config
Podman, Skopeo and image are using the normal gofmt also enforced via golangci-lint config AFAIK
Both have upsides and downsides, gofmt is the official tool but less strict. This means if someone is using gofumpt locally they might end up reformatting large parts of unrelated code making reviews harder, compare #27270. Which in turn means reviewers likely ask you to revert such formatting changes which means work.
On the other hand gofumpt is less "common" and not all might be using it, then PRs are failing CI due some minor formatting complains. This then also poses extra work for the contributor to fix them.
So overall it comes down to what most people generally use, given our projects seems to be split and we maintainers didn't have any strong option in either directions we like to hear form more contributors on what they prefer.
11 votes ·
Beta Was this translation helpful? Give feedback.
All reactions