chore(ci): add golangci-lint with a strong ruleset + fix CI Go version#61
Conversation
Greptile SummaryThis PR wires
Confidence Score: 5/5All changes are mechanical linting fixes with no behavior change; CI infrastructure improvements are well-reasoned and the tree is verified clean at zero findings. Every code change is a direct, verified fix for a specific linter finding: errcheck wrappers, permission tightening, parameter removals (each confirmed always-same at all call sites), type renaming, and doc comments. The refactors to startLifecycle, writeProjectError, and wrapLaunchCommandPowerShell are all semantically equivalent — the removed parameters were provably unused or constant. No new logic paths are introduced. No files require special attention. The permission changes (0o755→0o750, 0o644→0o600) are the most operationally visible effect, but they are intentional gosec fixes and affect only the daemon's own data/log directories. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[git push or PR] --> B[build job]
A --> C[lint job]
B --> B1[setup-go via go.mod]
B1 --> B2[go build]
B2 --> B3[go vet]
B3 --> B4[go test -race]
C --> C1[setup-go via go.mod]
C1 --> C2[golangci-lint-action v8 v2.12.2]
C2 --> C3{27 linters run}
C3 -->|zero findings| C4[pass]
C3 -->|any finding| C5[fail - blocks merge]
Reviews (7): Last reviewed commit: "chore(backend): add golangci-lint with a..." | Re-trigger Greptile |
1a495cc to
01e20ce
Compare
|
@greptile review |
01e20ce to
4d14de0
Compare
… tree Introduces backend/.golangci.yml (27 linters across correctness, dead-code/ boilerplate, style, and security), wires it into CI as a blocking job, and fixes every finding so the tree starts at zero. Config: - 27 linters: errcheck, govet, staticcheck, errorlint, bodyclose, sqlclosecheck, rowserrcheck, nilerr, makezero, unused, unparam, unconvert, wastedassign, copyloopvar, prealloc, dupl, revive (incl. exported-symbol doc comments), gocritic, misspell, usestdlibvars, predeclared, nakedret, gosec, … - Tuned for signal over noise: govet/shadow and gocritic hugeParam/rangeValCopy/ unnamedResult disabled (idiomatic-Go false positives); sqlc-generated code and tests get scoped exclusions; gosec G304 excluded (paths are config/run-file/ worktree-derived, not user input); nilerr excluded in cli/status.go (probe failures are the reported status, not a command error). CI: - New blocking lint job (golangci-lint-action, latest binary for Go-version compatibility). - go-version now read from go.mod (was pinned 1.22 while go.mod declares 1.25). Cleanup to reach zero (no behavior change): - errcheck: wrap deferred/inline Close()/Remove()/Rollback() with `_ =`. - gosec: tighten dir/file perms (0755->0750, 0644->0600). - unparam: drop always-nil error return from startLifecycle; drop unused shellPath param (zellij PowerShell) and always-500 fallbackStatus param (writeProjectError). - gocritic: regexp \d, s != "", switch->if, combined appends. - revive: doc comments on all exported symbols; rename project.ProjectRow -> project.Row (stutter); rename `max` locals shadowing the builtin. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
4d14de0 to
8df074b
Compare
|
Want your agent to iterate on Greptile's feedback? Try greploops. |
What
Introduces
golangci-lintto the backend with a strong, tuned ruleset, wires it into CI as a blocking job, and fixes every existing finding so the tree starts at zero.The config (
backend/.golangci.yml) — 27 lintersexporteddoc comments on every exported symbol), gocritic, misspell, usestdlibvars, predeclared, nakedretTuned for signal over noise:
govet/shadowandgocritichugeParam/rangeValCopy/unnamedResult disabled (idiomatic-Go false positives). Scoped exclusions: sqlc-generated code, tests,gosec/G304(paths are config/run-file/worktree-derived, not user input), andnilerrincli/status.go(probe failures are the reported status, not a command error).CI
lintjob (golangci-lint-action,latestbinary so it's built with a Go ≥ the module's).go.moddeclares 1.25. Both jobs now read fromgo.mod.Cleanup to reach zero (no behavior change)
84 findings fixed across every lane:
Close()/Remove()/Rollback()with_ =.0755→0750,0644→0600).startLifecycle; drop the unusedshellPathparam (zellij PowerShell) and the always-500fallbackStatusparam (writeProjectError).\dregex,s != "",switch→if, combined appends.project.ProjectRow→project.Row(stutter); renamemaxlocals shadowing the builtin.usestdlibvars/staticcheckauto-fixes (http.MethodGet, redundant embedded-field selectors).golangci-lint run ./...→ 0 issues;go build,go vet,go test ./...all green (21 packages).🤖 Generated with Claude Code