Skip to content

chore/linting fixes - #11

Merged
patdowney merged 10 commits into
masterfrom
chore/linting-fixes
Jul 23, 2026
Merged

patdowney merged 10 commits into
masterfrom
chore/linting-fixes

Conversation

@patdowney

Copy link
Copy Markdown
Contributor
  • chore: gofmt import grouping
  • fix: finalize FatalError's zerolog event so it actually logs and exits
  • fix: remove inert config-watch goroutine instead of advertising unsafe hot-reload
  • fix: deprecate global-Viper config path and fix contradictory precedence docs
  • fix: propagate configured logger into execFunc context
  • fix: use testify assertions consistently in logging and config tests
  • fix: clarify intentional double logger construction in ConfigureLogOutput
  • chore: fix pre-existing golangci-lint failures blocking make verify
  • docs: add architecture review findings with resolution status
  • chore: introduce APM

patdowney and others added 10 commits July 23, 2026 12:42
log.Fatal().Err(err) built the event but never called Msg/Send, which is
what triggers zerolog's write and its os.Exit(1) side effect. FatalError
was a silent no-op. Added .Msg(err.Error()) and a subprocess-based test
that exercises the actual exit path.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…e hot-reload

InitConfig called v.WatchConfig() but never registered an OnConfigChange
callback anywhere in the repo, so file changes never reached the caller's
config struct - the advertised hot-reload did nothing observable while
leaking one fsnotify goroutine per InitConfig call. Safely re-applying
changes into the caller's struct would require synchronized access (a
breaking API change), so the dead feature is removed rather than
half-fixed. WithoutWatchConfig is kept as a deprecated no-op for backward
compatibility.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…nce docs

InitViperConfig/InitViperConfigWithFlagSet operate on Viper's global
package-level singleton (unsafe for parallel tests/repeated calls, as the
existing test comments already acknowledge), while InitConfig uses a local
viper.New() instance. Mark the global-singleton functions Deprecated in
favor of InitConfig rather than removing them (removal would break
callers), and note their differing env-key replacer behavior.

doc.go and InitViperConfig's own doc comment also stated contradictory
config-merge precedence orders, neither matching Viper's actual documented
precedence (verified against Viper's official docs). Rewrote both
consistently.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
CobraRunE passed cmd.Context() straight through to execFunc, even though
InitConfig had just configured the global zerolog logger via
ConfigureCmdLogger. Command bodies had no way to retrieve that logger via
zerolog.Ctx(ctx) despite the library already handing them a context built
for exactly this kind of propagation (cli.Context/SetOrgName/SetAppName).
Wrap cmd.Context() with the configured logger before calling execFunc.
Purely additive - no signature changes.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
logging/logging_test.go predated testify adoption in this repo and used
raw t.Error/t.Errorf throughout; config_test.go mixed raw checks with
testify in the same file. Converted the remaining raw assertions to
assert/require, matching the style already used elsewhere in the suite
(integration_test.go, initconfig_test.go). Assertion library only, no
behavior change.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…tput

log.Logger is constructed once to guarantee a writable logger while
resolving file output, then again with the final output target. Add a
comment so this doesn't read as duplicated/dead code in a future edit.
Comment-only, no logic change.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Two issues predating this session's work were failing the project's
make verify gate: an unchecked fmt.Fprintf return in
NewVersionCommand's RunE (errcheck), and a lint-ignore comment in
TestContextWithNilBase using the wrong syntax for golangci-lint
(staticcheck's SA1012 was never actually suppressed). Neither is part
of the architecture-review findings; fixed separately so make verify
is green.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Phase 1 review findings for the cli module, now annotated with each
finding's resolution commit SHA and cognitive-complexity delta from
the Phase 2 pass.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@patdowney
patdowney merged commit 81256c9 into master Jul 23, 2026
4 checks passed
@patdowney
patdowney deleted the chore/linting-fixes branch July 23, 2026 13:29
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