Uh oh!
There was an error while loading. Please reload this page.
ci: wire golangci-lint + gosec into CI (advisory); migrate config to v2 - #423
Conversation
golangci-lint v1 is EOL and cannot typecheck this module (go.mod says go 1.26.0), and v2 binaries -- including what brew ships -- refuse v1-format configs, so make lint-full was broken for fresh installs. Migrated via `golangci-lint migrate` with the narrative comments preserved; same linter set (still no SSA linters, per #6), plus gosec for insecure-pattern scanning of our own code. Test files are gosec/errcheck-exempt per convention (12 additional findings fire there, all fixed-temp-path/perms test idioms). Part of tracebloc/backend#1305 (epic #930, Layer 1).
The config existed but nothing in CI loaded it. Official action pinned v9.3.0, golangci-lint pinned v2.12.2 (built with Go 1.26). Advisory by design: not in branch protection, and continue-on-error at the job level so the pre-existing 8-finding gosec backlog does not red-X unrelated PRs -- comes off at the required-flip after cleanup (backend#1303 pattern). Part of tracebloc/backend#1305 (epic #930, Layer 1).
LukasWodka
commented
Jul 29, 2026
bugbot run |
LukasWodka
commented
Jul 29, 2026
👋 Heads-up — Code review queue is at 45 / 30 Above the WIP limit. The team convention is to review existing PRs before opening new work. Open PRs currently in Code review (oldest first):
Pull from review before opening new work. (This is a nudge from the kanban WIP check, not a block.) |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 190c6c3. Configure here.
First run on #423 confirmed the quirk: job-level continue-on-error greens the workflow RUN but the job check run still red-Xs in the PR checks list. --issues-exit-code=0 gives the intended semantics: findings -> green job with inline annotations; infrastructure breakage (bad config, typecheck failure) -> still fails. Remove the arg at the required-flip (backend#1303 pattern).
LukasWodka
commented
Jul 29, 2026
bugbot run |
Uh oh!
There was an error while loading. Please reload this page.
Bugbot on #423: typecheck findings ride the issues exit path, so --issues-exit-code=0 greens them too -- the previous comment wrongly claimed typecheck failures still fail the job. Verified empirically (broken type: exit 0 with the flag, 1 without). Comment now states the real containment: required Test/Lint/Build jobs red a non-compiling PR, and a broken config still fails this job via the config-verify pre-step. Behavior unchanged.
LukasWodka
commented
Jul 29, 2026
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit ea7832d. Configure here.
What
.github/workflows/golangci.yml(new) — runs golangci-lint via the official action (golangci/golangci-lint-action@v9.3.0, golangci-lint pinnedv2.12.2) against the repo's.golangci.yml, on every PR + push to develop/main. Same trigger/concurrency shape as build.yml..golangci.yml— migrated v1 → v2 format (viagolangci-lint migrate, narrative comments preserved) and enablesgosec: the first scanner of our own code for insecure patterns (G-rules). govulncheck (already gating) only covers known CVEs in dependencies — different half of the problem. Linter set otherwise unchanged (still no SSA linters, per Re-enable staticcheck + unused linters once we have a strategy for the k8s.io dep tree #6). Test files are gosec/errcheck-exempt per convention — 12 additional findings fire there, all fixed-temp-path/relaxed-perms test idioms.Why
.golangci.ymlexisted but nothing in CI loaded it — build.yml's Lint job runs pinned standalone tools (the action was dropped in #6 when staticcheck/unused choked on the k8s.io dep tree). Two things have changed since:go 1.26.0made the v1-format config dead weight regardless: golangci-lint v1 is EOL (can't typecheck Go 1.26), and v2 binaries — including whatbrew install golangci-lintships, per CONTRIBUTING.md — refuse v1 configs. Somake lint-fullwas broken for anyone with a fresh install. The v2 migration fixes local dev and unblocks CI in one move.Advisory first (deliberate)
This check is not required — branch protection is untouched — and the run step passes
--issues-exit-code=0with a loud comment: golangci-lint exits non-zero on any finding by default, and the backlog below predates this PR. Findings surface as inline annotations + in the job log while the job stays green; infrastructure breakage (bad config, typecheck failure) still fails it. (First attempt used job-levelcontinue-on-error: true— the first run on this PR confirmed the known quirk that it greens the workflow run but still red-Xs the job in the PR checks list, so it was swapped for the exit-code arg.) The first run on this very PR sized the backlog. Flip to required (and remove the arg — a required check that can't fail is worse than none) after the backlog is worked off: the advisory → required pattern from tracebloc/backend#1303.The backlog this sizes: 8 findings, all gosec
(errcheck / govet / ineffassign / misspell / unconvert / gofmt / goimports: already clean — build.yml enforces the standalone equivalents.)
internal/cli/prepare_host.go:113,internal/cli/upgrade.go:123,internal/helm/upgrade.go:56,internal/nodeboot/nodeboot.go:35#nosec G204waivers with justification.internal/config/config.go:125,internal/push/detect.go:30,internal/push/image_resolution.go:30internal/slug/slug.go:90if r < 128; gosec doesn't credit the bound.#nosec G115+ comment.None are mechanical: all 8 want a per-site justification comment, which deserves its own reviewed pass rather than riding along on a CI-wiring PR. That cleanup + the required-flip is the follow-up tracked under tracebloc/backend#1305.
How verified
golangci-lint config verifypasses on the migrated config (the action's defaultverify: truere-checks this in CI)actionlint -onelineclean on the new workflowPart of tracebloc/backend#1305 (epic #930, Layer 1).
🤖 Generated with Claude Code
Note
Low Risk
Changes are CI and lint configuration only; no runtime application logic is modified, with advisory mode limiting merge impact until gosec backlog is addressed.
Overview
CI now runs golangci-lint against the repo config on PRs and pushes to
develop/main, via a new workflow using pinnedgolangci/golangci-lint-actionand golangci-lint v2.12.2. The job is advisory:--issues-exit-code=0keeps an existing 8 gosec findings from failing PRs while still surfacing annotations and logs; flipping to a required check is deferred until that backlog is cleared..golangci.ymlis migrated to golangci-lint v2 (version: "2", Go 1.26 aligned withgo.mod), withgosecenabled as the first linter scanning application code for insecure patterns (alongside dependency-only govulncheck). gofmt/goimports move to the v2formattersblock; test files stay exempt from errcheck and gosec under updated exclusion rules.Reviewed by Cursor Bugbot for commit ea7832d. Bugbot is set up for automated code reviews on this repo. Configure here.