Pre-Commit

Here’s how to set up pre-commit for Go projects.

  1. Install pre-commit for macOS: brew install pre-commit or see directions for curl/other options for WSL, Windows, Linux, etc.
  2. Use the template from TekWizely/pre-commit-golang: Pre-Commit hooks for Golang with support for Modules
    1. Several options are provided for fmt oriented commands. Comment out any duplicates that do not apply.
  3. 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.)