- Replace .golangci.yml with the canonical strict config (all linters
enabled except the standard disable list; lll 88, funlen 80/50,
cyclop 15, dupl 100; test files now linted)
- Pin the Dockerfile lint stage to golangci/golangci-lint:v2.12.2 by
tag and digest (Debian-based)
- Fix all ~1550 findings surfaced by the new config: line wrapping,
wsl_v5/nlreturn blank lines, noinlineerr splits, err113 sentinel
errors, perfsprint/modernize rewrites, goconst constants, thelper,
testifylint, noctx CommandContext, testpackage conversions,
t.Parallel() where safe, and complexity/dupl helper extraction
- Record the change and follow-up items in TODO.md
Change NewCLIInstance() and NewCLIInstanceWithFs() to return
(*Instance, error) instead of panicking on DetermineStateDir failure.
Callers in RunE contexts propagate the error. Callers in command
construction (for shell completion) use log.Fatalf. Test callers
use t.Fatalf.
Addresses review feedback on PR #18.
When os.UserConfigDir() fails, DetermineStateDir falls back to
os.UserHomeDir(). Previously the error from UserHomeDir was discarded,
which could result in a dangerous root-relative path (/.config/...) if
both calls fail.
Now DetermineStateDir returns (string, error) and propagates failures
from both UserConfigDir and UserHomeDir.
Closes#14
Fixed the first five errcheck linter errors:
- Added error handling for os.Unsetenv in cli_test.go
- Added error handling for file.Close() in crypto.go (4 instances)
Replace all os.Setenv calls with t.Setenv in test functions to ensure
proper test environment cleanup and better test isolation. This leaves
only legitimate application code and helper functions using os.Setenv.