This reference build is myctl, a multi-command operator tool: database migrations, cluster status, config-driven targets, a Bubble Tea progress UI, and a goreleaser pipeline that ships signed archives for Linux, macOS, and Windows.
Use it when your team needs more than a single main with flags but less than a full platform product.
Production CLIs in Go compile to one binary, start fast, and behave predictably in scripts.
This build uses cobra for command trees, viper for layered config, slog for machine-readable logs when --json is set, and Bubble Tea for interactive flows that still respect Ctrl+C cancellation.
Commands separate read operations (safe for CI) from write operations (confirmation prompts unless --yes).
Release automation embeds version, commit, and build date via -ldflags for supportability.
myctl --config ~/.config/myctl/config.yaml cluster status --context prodmyctl migrate up --dsn "$DATABASE_URL" --yesmyctl watch jobs --interval 2smyctl version --output json
When to reach for this layout:
Operators run the tool in CI, SSH sessions, and laptops against the same commands.
Subcommands map to domain workflows (migrate, deploy, diagnose), not Go packages.
You need config file + env + flag precedence without custom parsing code.
Long tasks benefit from a TUI while short tasks stay plain stdout.
Stack versions: This page was written for Go 1.26.x (Green Tea GC default, go fix modernizers - verify patch at build), chi (latest - verify at build), gin (latest - verify at build), echo (latest - verify at build), google.golang.org/grpc (latest - verify at build), sigs.k8s.io/controller-runtime (latest - verify at build), kubebuilder (latest - verify at build), tinygo (latest - verify board targets at build), wazero (latest - verify at build), and golangci-lint (latest - verify linter set at build).
Reviewed by Chris St. John·Last updated Jul 16, 2026