build: Use go install for linter and add cache. #3162
Merged
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.
This is rebased on #3161.
This modifies the GitHub Action workflow to install
golangci-lint
from source withgo install
instead of using the separate install script and adds~/.cache/golangci-lint
to the saved cache for faster future runs.The goal is to pin the dependency for the same reason the GitHub actions are pinned by hash. Namely, it reduces potential security risks such as compromised dependencies and dependency substitution attacks.
Using
go install
serves to pin the dependency because go verifies the downloaded module contents against the original checksum hashes they were first created with.