Modernize kuse: Go 1.25, lean deps, tests, and reliability fixes - #22
Conversation
Bump the toolchain and dependencies, replace archived go-homedir with stdlib home expansion, and harden path/symlink handling. Add unit tests, improve the Makefile/CI/release workflows, and polish CLI UX (version flag, stderr errors, sorted targets, auto-create dirs). Co-authored-by: Jeff Zellner <hello@jeffzellner.com>
Drop the heavy Viper dependency in favor of a small typed YAML config loader that preserves partial CLI overrides. Add --force/-f for non-interactive overwrite of a regular kubeconfig file, and skip hidden source files. Co-authored-by: Jeff Zellner <hello@jeffzellner.com>
ReviewSolid modernization. I'd merge after addressing two behavior regressions I was able to reproduce by building both branches and running them side by side. Independently verified on this branch: I also checked the Actions bumps, since the release workflow only fires on tags and CI can't cover it. The headline fix is genuine. On Two regressions worth fixing before merge1. The improved error messages are constructed and then thrown away.
if err := s.loadCurrent(); err != nil {
s.current.Name = "~none~"
}
A user whose kubeconfig is a real file now gets 2.
func expandHome(p string) (string, error) {
if p == "~" {
return os.UserHomeDir()
}
if strings.HasPrefix(p, "~/") || strings.HasPrefix(p, `~\`) {
...
}
return p, nil
}
It exits 0, creates a literal Rejecting A milder version of the same interaction: a typo'd One robustness point on
|
Surface loadCurrent failures on status (stderr), reject ~user home expansion, absolutize resolved paths, validate before writing config, and swap kubeconfigs via temp symlink + rename. Also align Makefile/CI checks, use go-arg Versioned, and document hidden-file skipping. Co-authored-by: Jeff Zellner <hello@jeffzellner.com>
|
Addressed the review feedback in ec1649b: Regressions
Smaller items
|
Re-review of ec1649bEvery point from the previous review was addressed. I verified the three substantive fixes at runtime rather than just reading the diff.
The three real issues are fixed1. Swallowed status errors. 2. No stray 3. Non-atomic swap. Bonus: the typo'd- All the smaller items landed as well: Test coverage grew meaningfully too — One thing only half-closed (non-blocking)Absolutizing happens at resolution time, but the config still persists the raw value, so a relative Writing the resolved absolute path instead of Two minor notes
LGTM — ready to merge from my side. |
Write resolved absolute kubeconfig/sources paths so relative CLI values keep a stable meaning across working directories. Validate the sources directory before any config write, and restore stderr via t.Cleanup in the status error test. Co-authored-by: Jeff Zellner <hello@jeffzellner.com>
|
Follow-up in 40b9dce:
|
Summary
Modernizes and hardens
kuseend-to-end: toolchain, leaner dependencies, reliability fixes, tests, CLI UX, and CI/release workflows.Changes
go-arg1.6.1)yaml.v3config + stdlib home expansion (much smaller module graph)filepathusage, dangling-symlink detection, relative symlink resolution, auto-create default sources dir, sorted targets, skip hidden source files, partial CLI overrides preserve other saved settings~userpaths, absolutize resolved paths, validate before persisting config, atomic temp-symlink + rename for switches/--force,make checkparity with CI, go-argVersioned, docs updates--version(ldflags / Versioned),--force/-f, help text, errors on stderr~userrejection, and status error surfacingtest/vet/checkwith-race), CI viamake check, Dependabot for Actions, Actions bumped to current majors, release embeds versionTest plan
make check--short,--force, dangling symlink,~userrejection, invalid target