Run golangci-lint from a task target so lint failures surface before CI - #300
Merged
Merged
Conversation
…, and fold it into task ci Signed-off-by: arashi.li <arashi.li@bigstack.co>
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.
Closes
Closes #299
What & why
CI runs
golangci-lintas its own job, but no task target did — sotask test,task test-integrationandtask cicould all be green while CI failed on lint. That happened on #298: 40/40 packages passed locally, CI failed on a one-lineineffassign.task lintnow runs the linter inside the builder, andtask ciincludes it.Two things make it the same analysis CI performs rather than an approximation, and both were found the hard way:
GOOS=linuxfrom a darwin host looked like the obvious fix and produced two SA5011 findings CI does not report — both false positives, on a deref that follows at.Fatalf. Cross-compiling loses staticcheck's fact thattesting.T.Fatalfis terminal, so it flags correct code. A target that invents failures is worse than no target.deps: [generate]. Without the bpf2go-generated typesinternal/bpfdoes not typecheck, and every dependent package is then analysed with degraded facts — silently. CI already runstask generatebefore lint for this reason.No source changes: the SA5011s needed no fix and are not excluded either; running natively means they never appear.
Test plan
task testtask test-integration(40/40 packages)Mutation-verified: reintroducing the exact
ineffassignthat failed CI on #298 makestask lintreport1 issues; reverting returns0 issues. So the target actually catches the class of bug that motivated it.Scope / deliberately not touched
internal/neutron/resolve_test.go— the two SA5011 findings there are false positives, so no code change and no exclusion entry. An exclusion would have been a lie that hid a real nil-deref later.Notes
golangci-lintis pinned in the builder image to the version.github/workflows/ci.ymlinstalls (2.12.2), with a comment on both sides to bump them together.One cost:
task setupmust be re-run after pulling this, ortask lintfails on a missing binary. Every other real task here (generate,binary,test-integration) already goes through the builder, so this follows the existing grain rather than introducing a new mechanism.DoD