Repository navigation
build: add golangci-lint, nilaway and race gate - #156
Merged
Merged
Conversation
Add a stricter Go static-analysis gate and resolve what it finds: - .golangci.yml (v2) enabling exactly errcheck, govet, staticcheck, unused, ineffassign, exhaustive, errorlint, nilerr, bodyclose, gosec and modernize. - nilaway over the module's own packages, and `go test -race ./...`. - Wire all three into `checks.<system>.*`, add nilaway to the devShell, and run the gate in CI. Fixes: a real nil-map write when the cache file holds JSON `null`; tighter cache file/dir perms; exhaustive switch on the cascade test pump; out-of-range tab index; unchecked file-close errors; int->int32 GraphQL narrowing; nil-slice normalization; modernize auto-fixes. Narrow gosec suppressions for intended subprocess/file-inclusion cases.
Per owner decision, gosec runs on production code only: `linters.exclusions.rules` skips `_test\.go`. Drop the now-redundant `//nolint:gosec` directives those test fixtures carried.
Pin actions/checkout and DeterminateSystems/nix-installer-action to full commit SHAs (with a version comment), so a moved or compromised tag cannot execute in CI with the workflow token.
The SetPRs/SetIssues normalization already keeps the section slices non-nil, so the nilaway-driven length guards on numberAt no longer earn their keep; restore the original one-liners.
noamsto
deleted the
feat/155-add-golangci-lint-nilaway-and-race-gate
branch
September 29, 2026 16:08
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 #155
Summary
Add a stricter Go static-analysis gate and fix what it finds.
.golangci.yml(v2) enables exactlyerrcheck,govet,staticcheck,unused,ineffassign,exhaustive,errorlint,nilerr,bodyclose,gosecandmodernize, withexhaustive: default-signifies-exhaustive: true.gosec is excluded for
*_test.go(owner decision); it stays on for productioncode.
nilawayruns over the module's own packages;go test -race ./...runs therace detector.
checks.<system>.*, sonix flake checkenforces them; thedevShell gains
nilaway, and CI builds the three checks.Plan: task doc (provided)
Findings tally
modernizefindings are one grouped row per analyzer; identical sites aregrouped.
nullcache file unmarshalled to a nil map, so the nextSetpanicked; guard + regression testtabsbefore indexing the active tabCloseerror instead of discarding it#[must_use]warns at most_ =on best-effort close/remove in an error pathcascadeSettlearmgqlInthelperastruncates silently;i32::try_fromforces handlinglen/error checks before indexing test resultsos.Exit(1)*_test.goby owner decision; three fixture permissions tightened in passing--enable-only modernize --fix(strings.Cut/Seq, range-int,min/max)fmt.FprintfoverWriteString(Sprintf)groupByCategory/groupByAuthorSummary: 81 findings: 2 real bugs (1 Rust-catchable), 9 latent, 51 false positives, 19 style.
Testing
golangci-lint run ./...→0 issues.nilaway -include-pkgs=github.com/noamsto/prdash ./...→ no findings (exit 0)go test -race ./...→ all packagesok(exit 0)nix build .#checks.x86_64-linux.golangci-lint .#checks.x86_64-linux.nilaway .#checks.x86_64-linux.go-test-race→ exit 0go build ./...,go vet ./...,go test ./...,nix fmt→ exit 0go test ./internal/cache -run TestOpenNullFileStaysWritable— panics (nil-map write) without the guard, passes with itReview notes
_test.gogosec exclusion — refuted: an explicit owner/dispatcher decisionfor this task that overrides the task doc's general no-exclusion rule, and the
only path exclusion allowed; gosec stays on for production code.
Agent ledger
Acceptance ledger
golangci-lint,nilawayandgo test -raceall green, locally and aschecks.<system>.*(commands above).pr_opendetail.Review ledger
.github/workflows/ci.yml:13accept.golangci.yml:24recurrence_escalation: unused