feat(go-ci): let callers raise the lint timeout - #7
Closed
juicycleff wants to merge 2 commits into
Closed
Conversation
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.
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. |
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.
Summary
Adds
golangci-lint-timeoutto the reusable Go CI workflow, defaulting to5mso 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.v1is a moving major tag on this repo, so once this merges, every caller pinned tov1picks it up immediately.Test plan
actionlint .github/workflows/go-ci.ymlpasses locallyyaml.safe_load)