Using Pre-Commit Tooling
Here’s how to set up pre-commit for Go projects.
- Install pre-commit for macOS:
brew install pre-commit
or see directions for curl/other options for WSL, Windows, Linux, etc. - Use the template from TekWizely/pre-commit-golang: Pre-Commit hooks for Golang with support for Modules
- Several options are provided for
fmt
oriented commands. Comment out any duplicates that do not apply.
- Several options are provided for
- Finally, initialize the pre-commit hooks in your repo by running:
pre-commit install
Validate that everything is working by running: pre-commit run --all-files
Periodically, you can run pre-commit autoupdate
to ensure that the latest version of the pre-commit hooks is upgraded.
Webmentions
(No webmentions yet.)