mvdan / gofumpt

A stricter gofmt
https://pkg.go.dev/mvdan.cc/gofumpt
BSD 3-Clause "New" or "Revised" License
3.15k stars 110 forks source link

Provide pre-commit hook configuration #258

Closed trallnag closed 1 year ago

trallnag commented 1 year ago

Pre-commit is a framework for managing and maintaining multi-language pre-commit hooks. People use it for example to format their code automatically on every commit.

It would be great if this repository could provide a configuration for it similar to how golangci-lint and other repos do it:

https://github.com/golangci/golangci-lint/blob/master/.pre-commit-hooks.yaml

The alternative is to mirror this repository and include the .pre-commit-hooks.yaml file there.

trallnag commented 1 year ago

I have created a mirror of gofumpt that includes a .pre-commit-hooks.yaml file.

https://github.com/trallnag/pre-commit-mirror-gofumpt

mvdan commented 1 year ago

I'm not sure what happened on January 24th, but someone made a very similar suggestion in another project of mine: https://github.com/mvdan/sh/pull/966

My response is the same, given that both Go programs are equally easy to run on their own.

trallnag commented 1 year ago

Pre-commit added bootstrapping of Go if Go is not already installed. That's probably why.

But as gofumpt would only ever be used in Go projects this is not a real benefit. Except maybe the support for this new https://pre-commit.ci service that does not have Go preinstalled.

Thanks for the response