-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add --version option to the rootCmd #301
Conversation
Hi @N4r35h, Thanks for this! I was thinking of using go's build process for this issue instead and pass the versioning information to the linker via It could default to dev or something of the sorts. Feel free to explore this route and update this PR. Thanks. |
sure @guergabo, i added the vsc.version (automatically set by go build) which is the commit hash also feeling it might be useful where we distribute dev versions of the build for testing and want to correlate to the particular commit also seen it done by the docker cli, we can add more info such as version of golang it was compiled with and built time if required could you explain about the github release workflow or confirm if thats being used right now ?
|
cmd/version/version.go
Outdated
var Version string = "dev" | ||
|
||
var VersionCmd = &cobra.Command{ | ||
Use: "version", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to make a whole command out of this a variable should do. check this out: https://www.digitalocean.com/community/tutorials/using-ldflags-to-set-version-information-for-go-applications
cmd/root.go
Outdated
@@ -42,6 +43,7 @@ func init() { | |||
rootCmd.AddCommand(dst.NewCmd()) | |||
rootCmd.AddCommand(serve.ServeCmd()) | |||
rootCmd.AddCommand(quickstart.NewCmd()) | |||
rootCmd.AddCommand(version.VersionCmd) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the behavior should still remain using the cobra version flag: resonate --version
regarding the github release workflow, it starts here: https://github.com/resonatehq/resonate/blob/main/.github/workflows/release.yaml let me take a look in the morning and suggest some follow up actions, because we would want the version information passed to both our |
ok, for docker image release build:
for github release build:
|
thanks for pointing out the flake.nix file i have made the requested changes consider it a draft let me know if anything else is required |
) | ||
|
||
func computeVersion() string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check out the link i sent before, i'll paste here again: https://www.digitalocean.com/community/tutorials/using-ldflags-to-set-version-information-for-go-applications
this whole function is not needed.
resolves issue #298
its already built into cobra just needed to add the Version string to the rootCommand