Skip to content

ci: track the go toolchain from go.mod - #467

Merged
jahvon merged 2 commits into
mainfrom
fix/ci-go-126
Sep 22, 2026
Merged

jahvon merged 2 commits into
mainfrom
fix/ci-go-126

Conversation

@jahvon

@jahvon jahvon commented Sep 22, 2026

Copy link
Copy Markdown
Member

What's failing

Every open PR — and main itself — fails the security job. PR #461 (mvdan.cc/sh 3.13.1 → 3.14.1) fails every job. Both come from the same place: CI pins go-version: "1.25.x" in all 14 setup-go steps, and setup-go sets GOTOOLCHAIN=local, so nothing can upgrade on its own.

security (all PRs + main):

go: golang.org/x/vuln/cmd/govulncheck@latest: golang.org/x/vuln@v1.8.0
    requires go >= 1.26.0 (running go 1.25.14; GOTOOLCHAIN=local)
"govulncheck": executable file not found in $PATH
Security scan completed. Results saved to govuln.sarif   <- empty file

The reported error (Invalid SARIF. JSON syntax error: Unexpected end of JSON input, at the upload step) is a downstream symptom. The scan script had no set -e, so a failed install and a missing binary both continued, wrote an empty govuln.sarif, and printed "Security scan completed". This started when x/vuln v1.8.0 was published; it is not caused by any of the PRs.

#461: the new mvdan.cc/sh needs Go 1.26, so dependabot raised the go directive to 1.26.0 — which CI cannot build.

The change

  • All setup-go steps use go-version-file: go.mod instead of a hardcoded 1.25.x, across ci.yaml, codeql.yaml, release.yaml and windows-ci.yml. The toolchain now follows the directive rather than drifting from it.
  • go.mod: go 1.25.81.26.0, which is what x/vuln and mvdan.cc/sh require. The Dockerfile is already on golang:1.27.0-bookworm.
  • set -euo pipefail on the security scan, so an install failure fails that step with its real error instead of uploading an empty SARIF. $CI is now read as ${CI:-} so set -u doesn't trip on it when unset locally.

CI pinned go-version: "1.25.x" in every setup-go step, and setup-go sets
GOTOOLCHAIN=local, so nothing could upgrade on its own. Two failures followed
once dependencies moved to Go 1.26:

- govulncheck's install pulls x/vuln v1.8.0, which needs go >= 1.26. The
  install failed, the scan ran a missing binary, and the job failed two steps
  later on an empty SARIF file.
- The mvdan.cc/sh v3.14.1 bump raises the go directive to 1.26.0, which CI
  could not build at all.

Reading the version from go.mod keeps the toolchain and the directive from
drifting apart again.

set -euo pipefail on the security scan makes an install failure fail that step
with its real error instead of uploading an empty SARIF. The CI branch still
exits 0 when vulnerabilities are found, so reporting is unchanged; the local
branch now exits non-zero, which validate does not run.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@codecov

codecov Bot commented Sep 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

The pinned v2.5.0 release binary is built upstream with go1.25, and
golangci-lint refuses to run when its own build's language version trails the
targeted one - so raising the go directive to 1.26.0 broke the lint job:

  can't load config: the Go language version (go1.25) used to build
  golangci-lint is lower than the targeted Go version (1.26.0)

go run builds it with this repo's toolchain, so the two cannot diverge again,
and it pins one version for CI and local runs instead of deferring to whatever
is on PATH. That gap is why this stayed hidden: local runs used 2.7.2 built
with go1.26 while CI ran a 2.5.0 binary built with go1.25.

The version stays at v2.5.0, which reports no issues. Later releases are clean
to adopt but surface 57 new findings, which belong in their own change.

install tools no longer installs golangci-lint, leaving one pin rather than two
to keep in step.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@jahvon
jahvon merged commit 940effb into main Sep 22, 2026
22 checks passed
@jahvon
jahvon deleted the fix/ci-go-126 branch September 22, 2026 18:00
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