Replies: 2 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.
1 reply
-
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.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
7 votes ·
Beta Was this translation helpful? Give feedback.
All reactions