From 09812a562a0d45faf7588090d17ce084587d5c71 Mon Sep 17 00:00:00 2001 From: Samuel K Date: Sun, 21 Jun 2026 17:27:26 -0500 Subject: [PATCH] ci: pin golangci-lint and align local lint with CI diff filter Pre-commit pinned an older golangci-lint (v2.11.4) and ran without the diff filter that CI applies, so violations introduced by a patch could pass locally and fail in CI. Match versions, mirror the --new-from-rev=origin/main filter in the hook, and rename the Taskfile target to cli:lint:ci so "did I match CI?" is a single command. --- .github/workflows/pr-ci.yml | 2 +- .pre-commit-config.yaml | 4 ++-- Taskfile.yml | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/pr-ci.yml b/.github/workflows/pr-ci.yml index c78e8e24e..99cdef3da 100644 --- a/.github/workflows/pr-ci.yml +++ b/.github/workflows/pr-ci.yml @@ -57,7 +57,7 @@ jobs: - name: golangci-lint uses: golangci/golangci-lint-action@v9 with: - version: latest + version: v2.12.2 only-new-issues: true can-read-secret: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b1ea464cf..24c68b5f3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -54,8 +54,8 @@ repos: - id: commitizen stages: [commit-msg] - repo: https://github.com/golangci/golangci-lint - rev: v2.11.4 + rev: v2.12.2 hooks: - id: golangci-lint - args: ["--timeout", "10m"] + args: ["--timeout=10m"] - id: golangci-lint-fmt diff --git a/Taskfile.yml b/Taskfile.yml index 5470e2fbc..77d158dec 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -9,9 +9,9 @@ tasks: desc: lint go code using golangci-lint cmd: golangci-lint run ./... - cli:lint:new: - desc: lint go code changed since origin/main using golangci-lint - cmd: golangci-lint run --new-from-rev="$(git merge-base HEAD origin/main)" ./... # or use --new-from-rev=HEAD~1 for changes since last push or --new for changes since last commit + cli:lint:ci: + desc: lint as CI does (diff-filtered against origin/main); use --new-from-rev=HEAD~1 to scope to last push or omit for full lint + cmd: golangci-lint run --new-from-rev="$(git merge-base HEAD origin/main)" ./... cli:lint:fix: desc: fix lint issues using golangci-lint