ci: run the lint config the repo actually declares - #268
Merged
Conversation
.golangci.yml is schema v2, but the workflow pinned golangci-lint v1.57.2, which silently ignores the v2-only `linters.settings` and `formatters` sections. The revive rule list and the goimports check never ran in CI. Lint now runs `make lint`, so CI and local share the single version pinned in the Makefile. Rename the build job to test and drop the duplicate `make build`. The job ran clean+build twice, and `make test` does not need the binary. Pin both jobs to `go-version: stable`, replacing the spread of go.mod 1.20, the lint job's 1.21 and the build job's unpinned runner default. Add least-privilege permissions, cancel superseded pull request runs, and drop `fetch-depth: 0` since the version stamp works at depth 1.
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.
CI's lint gate has not been enforcing
.golangci.yml. The config is schema v2, but the workflow pinned golangci-lint v1.57.2, which does not recognise the v2-onlylinters.settingsandformatterssections and drops them without erroring. The revive rule list and the goimports check have been dead in CI, so the green checks came from a weaker default set. Probing both binaries against the same config: v2.6.0 flagsget-returnand goimports violations, v1.57.2 flags neither.Lint now runs
make lint, so CI and local share the single version pinned in the Makefile and cannot drift apart again. The tradeoff is compiling golangci-lint on a cold cache instead of downloading a prebuilt binary.Also renames the build job to test and drops the duplicate
make build, which ran clean+build twice whilemake testdoes not need the binary. Both jobs now pingo-version: stable, replacing the spread of go.mod 1.20, the lint job's 1.21 and the build job's unpinned runner default. Adds least-privilege permissions and cancellation of superseded pull request runs.