Repository navigation
feat(go-ci): warm the build cache before linting, and let callers set the timeout - #8
Merged
Merged
Conversation
… 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.
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
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: trueon purpose. A module that genuinely doesnot 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-timeoutexposes the deadline, defaulting to the5mthat washardcoded 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
actionlintis clean. The self-test smoke jobs exercise the lint path on thefixtures, so the warm step gets a run here before any consumer sees it.