Skip to content

ci: fix golangci-lint install failure and pin tool versions - #14

Merged
major0 merged 1 commit into
mainfrom
fix/pre-commit-golangci-lint
Sep 23, 2026
Merged

major0 merged 1 commit into
mainfrom
fix/pre-commit-golangci-lint

Conversation

@major0

@major0 major0 commented Sep 23, 2026

Copy link
Copy Markdown
Owner

Summary

The Pre-commit workflow is failing on unrelated pull requests while installing
golangci-lint. It is an upstream installer bug, not a corrupt download and not a
supply-chain problem.

install-go-tools.sh pipes golangci-lint's install.sh from master and asks
for latest, which currently resolves to 2.13.2. That script looks up the
release checksum by matching the asset filename without anchoring, so
golangci-lint-2.13.2-linux-amd64.tar.gz also matches
golangci-lint-2.13.2-linux-amd64.tar.gz.sbom.json, and it reads the SBOM's
checksum instead of the tarball's.

Both hashes in the CI error are genuine, published, and belong to different
assets:

Hash Asset
2277d43b… golangci-lint-2.13.2-linux-amd64.tar.gz (what was downloaded)
df5b9676… golangci-lint-2.13.2-linux-amd64.tar.gz.sbom.json (what it compared against)

Any release that ships an SBOM beside the tarball trips this.

Changes

  • Install golangci-lint with go install from the module proxy rather than
    curl | sh. Verification moves to the proxy and checksum database instead of
    a hand-rolled hash check in a script fetched from master.
  • Pin golangci-lint to v2.13.2 and goimports to v0.50.0. Floating on
    latest is what allowed an upstream release to break CI on a pull request
    that changed nothing related.

Testing

  • go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.13.2
    installs cleanly and the binary reports 2.13.2.
  • shellcheck --shell=sh .github/scripts/install-go-tools.sh is clean.
  • sh -n .github/scripts/install-go-tools.sh parses.
  • Pre-commit hooks pass locally on the commit, including commitlint.

The real verification is this PR's own Pre-commit run, which exercises the
changed installer.

Notes for review

go install builds without release ldflags, so golangci-lint --version
reports 2.13.2 with (unknown, modified: ?) build metadata. Cosmetic for
linting, but worth knowing if anything parses that output.

v2.13.2 is what latest happened to resolve to. If CI was previously passing
against an older golangci-lint, this pin may surface new findings — worth a look
before merge, and easy to pin lower instead.

Unblocks

#13, which is red purely because of this installer failure.

The pre-commit workflow failed while installing golangci-lint, with a
checksum mismatch that had nothing to do with the change under test:

  want df5b9676864cd25a50ef840fcb2644e1627bbce1636d5bf422758e7c3934e7e1
  got  2277d43b98ec0054280f2ac26b53268bae97682444678a59a657dd565da021d6

Those hashes are both published for the 2.13.2 release, but they belong to
different assets. 2277d43b is the linux-amd64 tarball, the file actually
downloaded. df5b9676 is that tarball's .sbom.json sidecar. Upstream's
install.sh looks the checksum up by matching the asset filename without
anchoring, so golangci-lint-2.13.2-linux-amd64.tar.gz also matches
golangci-lint-2.13.2-linux-amd64.tar.gz.sbom.json and it reads the wrong
line. Any release shipping an SBOM alongside the tarball trips this.

Install golangci-lint with go install instead. Verification moves to the
module proxy and checksum database rather than a hand-rolled hash check in
a shell script fetched from master, and the curl-pipe-to-shell step leaves
CI entirely.

Pin both tool versions while here. Requesting latest meant an upstream
release could break CI on a pull request that changed nothing related,
which is exactly what happened.

Note that go install builds without release ldflags, so the version string
carries "(unknown, modified: ?)" build metadata. The reported version
number is still correct.

Assisted-by: Kiro <noreply@kiro.dev> (1.0.116)
@major0
major0 merged commit 8869d7f into main Sep 23, 2026
11 of 12 checks passed
@major0
major0 deleted the fix/pre-commit-golangci-lint branch September 23, 2026 12:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant