Skip to content

feat(go-ci): let callers raise the lint timeout - #7

Closed
juicycleff wants to merge 2 commits into
mainfrom
feat/lint-timeout-input
Closed

feat(go-ci): let callers raise the lint timeout#7
juicycleff wants to merge 2 commits into
mainfrom
feat/lint-timeout-input

Conversation

@juicycleff

Copy link
Copy Markdown
Contributor

Summary

Adds golangci-lint-timeout to the reusable Go CI workflow, defaulting to 5m so nothing changes for existing callers. A large module with a cold build cache can blow through the hardcoded timeout before context loading even finishes, and callers had no input to raise it.

Second commit runs go build ./... before golangci-lint. Lint reads dependency export data out of GOCACHE the same way a build does, and setup-go only warms the module cache, not the build cache, so a cold runner has lint compile everything itself inside the timeout window. Building first fills that cache for lint to reuse on the same runner, and turns an unbuildable module into a plain compiler error instead of a confusing timeout. It costs a few seconds on a small caller and saves much more on a large one. It's a separate commit so it can be reverted on its own if it does not pan out.

v1 is a moving major tag on this repo, so once this merges, every caller pinned to v1 picks it up immediately.

Test plan

  • actionlint .github/workflows/go-ci.yml passes locally
  • YAML parses (yaml.safe_load)
  • Exercise on a real caller (foundry) with the new input set before merging

golangci-lint-action hardcodes --timeout=5m today. A caller with a
large module and a cold build cache (setup-go only warms the module
cache, not the build cache) can blow through that before context
loading even finishes, and had no way to ask for more time. Add
golangci-lint-timeout, defaulting to 5m so every existing caller
keeps behaving exactly as it does now.
golangci-lint reads dependency export data out of GOCACHE the same
way a build does, and setup-go never populates that cache, only the
module cache. Running go build first fills it in for lint to reuse
on the same runner, which is most of why cold lint is slow on a
large module, and it turns an unbuildable module into a clear
compiler error instead of a lint timeout.

Kept as its own commit so it can be dropped independently of the
timeout input if it turns out not to be worth the cost on small
callers.
@juicycleff

Copy link
Copy Markdown
Contributor Author

Superseded by #8, which adds the same golangci-lint-timeout input and also warms the build cache before linting. The cold cache was the actual cause of the 5m timeout: setup-go only restores the module cache, so golangci-lint was typechecking every package from scratch inside the window. Shipped in v1.18.0, and v1 points at it.

@juicycleff juicycleff closed this Sep 5, 2026
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