| 1 | minimum_pre_commit_version: "3.5.0" |
| 2 | |
| 3 | repos: |
| 4 | # General text cleanup for markdown files |
| 5 | - repo: https://github.com/pre-commit/pre-commit-hooks |
| 6 | rev: v6.0.0 |
| 7 | hooks: |
| 8 | # Remove trailing whitespace |
| 9 | - id: trailing-whitespace |
| 10 | |
| 11 | # Ensure files end with a newline |
| 12 | - id: end-of-file-fixer |
| 13 | |
| 14 | # Fix mixed line endings (convert to LF) |
| 15 | - id: mixed-line-ending |
| 16 | args: ["--fix=lf"] |
| 17 | |
| 18 | # Fix UTF-8 byte order marker |
| 19 | - id: fix-byte-order-marker |
| 20 | |
| 21 | - repo: https://github.com/golangci/golangci-lint |
| 22 | rev: v2.10.1 |
| 23 | hooks: |
| 24 | - id: golangci-lint-config-verify |
| 25 | name: golangci-lint-config-verify |
| 26 | description: Verifies the configuration file |
| 27 | entry: golangci-lint config verify |
| 28 | files: '\.golangci\.(?:yml|yaml|toml|json)' |
| 29 | language: golang |
| 30 | - id: golangci-lint |
| 31 | name: golangci-lint |
| 32 | description: Fast linters runner for Go. Note that only modified files are linted, so linters like 'unused' that need to scan all files won't work as expected. |
| 33 | entry: golangci-lint run --new-from-rev HEAD --fix |
| 34 | types: [go] |
| 35 | language: golang |
| 36 | require_serial: true |
| 37 | pass_filenames: false |
| 38 | - id: golangci-lint-full |
| 39 | name: golangci-lint-full |
| 40 | description: Fast linters runner for Go. Runs on all files in the module. Use this hook if you use pre-commit in CI. |
| 41 | entry: golangci-lint run --fix |
| 42 | types: [go] |
| 43 | language: golang |
| 44 | require_serial: true |
| 45 | pass_filenames: false |
| 46 | |
| 47 | - repo: local |
| 48 | hooks: |
| 49 | - id: make-fmt |
| 50 | name: make fmt |
| 51 | description: Formats Go source code with gofmt and goimports. |
| 52 | entry: make fmt |
| 53 | types: [go] |
| 54 | language: system |
| 55 | pass_filenames: false |
| 56 | |
| 57 | - id: go-vet |
| 58 | name: go vet |
| 59 | description: Runs go vet checks. |
| 60 | entry: go vet ./... |
| 61 | types: [go] |
| 62 | language: system |
| 63 | pass_filenames: false |