Skip to content

CI: gofmt/lint/tidy/vulncheck gates, enable -race - #34

Merged
naliyi merged 3 commits into
bump-nmilat-0.2.7from
ci-gofmt-lint-tidy-vulncheck
Sep 4, 2026
Merged

CI: gofmt/lint/tidy/vulncheck gates, enable -race#34
naliyi merged 3 commits into
bump-nmilat-0.2.7from
ci-gofmt-lint-tidy-vulncheck

Conversation

@naliyi

@naliyi naliyi commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Stacked on #33 (needed for its go1.26.8 bump -- without it, govulncheck fails on the current go1.26.1 directive's stdlib CVEs). Retarget to main once #33 merges.

  • Matches nmilat's own CI structure (ohstr/nmilat, added in its PR docs: note (#N) is plain text in CHANGELOG.md, links only in the release #7): check gains Gofmt/Build/Tidy steps alongside the existing Vet/Test; lint (golangci-lint v2.13) and vulncheck (govulncheck) run as separate parallel jobs.
  • Fixes the 178 pre-existing errcheck/staticcheck/unused findings this surfaced first -- see the lint-cleanup commit's message for the handful that needed real judgment (client/recovery.go, cli/bunker/policy.go, cli/bunker/command.go's daemon.Run, client/client.go/client/ping.go's app.Run) versus the rest (best-effort Close/Flush/Fprint*/MarkFlag* boilerplate).
  • No behavior change: full diff is either error-return handling on cleanup/boilerplate calls, or the specific judgment-call fixes noted above.

Test plan

  • gofmt -l . clean
  • go build ./...
  • go vet ./...
  • go mod tidy -- no diff
  • go test -short -race ./... -- all packages green
  • golangci-lint run ./... --max-issues-per-linter=0 --max-same-issues=0 -- 0 issues
  • govulncheck ./... -- 0 vulnerabilities affecting this code

Purely mechanical -- no behavior change. Needed before adding a gofmt CI
gate, since these files predate it and had drifted.
…k/unused)

178 pre-existing errcheck findings (mostly best-effort Close()/Flush()/
Fprint*/WriteMessage/MarkFlag* calls whose error was never actionable),
15 staticcheck quick-fixes (embedded-field selector simplification, De
Morgan's, Fprintf-over-WriteString+Sprintf, an empty branch), and 3 unused
findings -- all found ahead of adding CI gates for them.

A few needed real judgment rather than blind suppression, since they're
this codebase's own persistence/lifecycle calls rather than stdlib
boilerplate:
- client/recovery.go's deleteMeta/saveMeta/metaDB.View calls now log on
  failure instead of silently dropping it, matching this file's existing
  log.Error()/log.Warn() convention -- a lost delete/save here means a
  retry-recovery entry silently goes stale or never converges.
- cli/bunker/policy.go's two saveLocked() calls (resolveGrantLocked,
  Prune) are left as best-effort with an explanatory comment: in-memory
  grant state is already updated and authoritative, and this package has
  no logger dependency anywhere else to introduce just for these two
  sites.
- cli/bunker/command.go's `go daemon.Run(ctx)` now logs via the daemon's
  own d.log() if Run returns (currently only reachable via "no relays
  configured", silently dropped before -- the bunker command would just
  hang with zero explanation).
- client/client.go's Ctrl+S save callback now surfaces a failure via
  c.app.Error(), matching the sibling callback right above it that
  already does this for a different error. Its TUI's app.Run() (and
  client/ping.go's) now logs via the existing zerolog logger instead of
  discarding a real startup/render failure.

cli/relay/service.go also drops a dead, comment-explained no-op branch
for config.HandshakeTimeout: it's parsed but was never wired to anything
(relay.SessionConfig has no such field) -- actually wiring it up would be
a real behavior change belonging in its own PR, not this cleanup.
check gains Gofmt/Build/Tidy steps alongside the existing Vet/Test; two
new jobs, lint (golangci-lint v2.13) and vulncheck (govulncheck), run in
parallel. All four pass clean against the current tree as of the prior
lint-cleanup commit.
@naliyi
naliyi marked this pull request as ready for review September 4, 2026 09:20
@naliyi
naliyi merged commit 1ff0dd0 into bump-nmilat-0.2.7 Sep 4, 2026
5 of 6 checks passed
naliyi added a commit that referenced this pull request Sep 4, 2026
Merge CI gates work (PR #34) into main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant