You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Feat: Add a version subcommand (ldflags currently inject into a non-existent package) #27
transfer version does not exist — an unknown command falls straight into panic():
$ transfer version
Error: unknown command "version" for "transfer"
panic: unknown command "version" for "transfer"
.goreleaser.yml tries to inject the version via ldflags into github.com/linuxsuren/cobra-extension/version, but that module is neither imported nor present in go.mod/go.sum — the injection is dead, and nothing in the binary prints the value anyway.
Technical requirement
cobra (rootCmd.Version / a small version subcommand), Go build-time variable injection.
Expect
transfer version prints a semantic version plus commit and build date, e.g. v0.0.7 (a4ebe30, 2022-09-26),
the value comes from goreleaser ldflags pointed at a package that actually exists (main), with a dev fallback for source builds,
--version on the root command works too.
Potential TODO list
add version/commit/date vars in main and a version subcommand
fix the goreleaser ldflags target package
stop using panic(err) for CLI errors while at it (print and exit non-zero)
Pattern is well established in other linuxsuren CLIs — good first issue.
Activity