Skip to content

feat(go-ci): warm the build cache before linting, and let callers set the timeout - #8

Merged
juicycleff merged 1 commit into
mainfrom
feat/lint-cold-cache
Sep 5, 2026
Merged

juicycleff merged 1 commit into
mainfrom
feat/lint-cold-cache

Conversation

@juicycleff

Copy link
Copy Markdown
Contributor

golangci-lint typechecks the whole module while it loads packages. With nothing
in GOCACHE that can outrun the deadline before a single linter runs, and the
failure names neither the repo nor the cause:

context loading failed: failed to load packages: context deadline exceeded

foundry hits this on every run. twinos already carries the same fix inline, so
this moves it somewhere the other consumers get it too.

What changed

The lint job builds the module before linting, which fills GOCACHE so package
loading reuses the compiled output instead of typechecking from scratch.

That step is continue-on-error: true on purpose. A module that genuinely does
not compile should be reported by golangci-lint, with a file and a line, rather
than as a bare build failure in a step the caller never asked for. So this
warms the cache and never changes whether the job passes.

golangci-lint-timeout exposes the deadline, defaulting to the 5m that was
hardcoded before. Warming the cache addresses the usual cause, so the input is
for repos where linting itself is honestly slow, not a way to paper over a cold
start. Existing callers see no change from either half.

Checked

actionlint is clean. The self-test smoke jobs exercise the lint path on the
fixtures, so the warm step gets a run here before any consumer sees it.

… the timeout

golangci-lint typechecks the whole module while loading packages. With nothing
in GOCACHE that can outrun the deadline before a single linter runs, and the
failure names neither the repo nor the cause:

    context loading failed: failed to load packages: context deadline exceeded

foundry hits this on every run. twinos already carries the same fix inline, so
this moves it where the other consumers get it too.

The lint job now builds the module first, which fills GOCACHE so package
loading reuses the compiled output. The step is non-fatal on purpose: a module
that genuinely does not compile deserves a golangci-lint report with a file and
a line, not a bare build failure in a step the caller never asked for.

golangci-lint-timeout exposes the deadline, still 5m by default. Warming the
cache addresses the usual cause, so this is for repos where linting itself is
honestly slow rather than a way to paper over a cold start.
@juicycleff
juicycleff merged commit 1fb7007 into main Sep 5, 2026
42 checks passed
@juicycleff
juicycleff deleted the feat/lint-cold-cache branch September 6, 2026 03:19
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