-
Notifications
You must be signed in to change notification settings - Fork 29
Don't hardcode the version #353
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
Conversation
and add a `version` command that only prints the version (without the build time) Signed-off-by: Dimitris Karakasilis <dimitris@karakasilis.me>
| - CGO_ENABLED=0 | ||
| ldflags: | ||
| - -s -w | ||
| - -X "github.com/mudler/luet/cmd.Version={{ .Summary }}" |
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.
| # go tool nm ./luet | grep Commit | ||
| override LDFLAGS += -X "github.com/mudler/luet/cmd.BuildTime=$(shell date -u '+%Y-%m-%d %I:%M:%S %Z')" | ||
| override LDFLAGS += -X "github.com/mudler/luet/cmd.BuildCommit=$(shell git rev-parse HEAD)" | ||
| override LDFLAGS += -X "github.com/mudler/luet/cmd.Version=$(shell git describe --dirty --always --tags)" |
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.
same as .Summary above (see link)
| Use: "version", | ||
| Short: "Print the version of luet", | ||
| Run: func(cmd *cobra.Command, args []string) { | ||
| fmt.Println(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.
~/workspace/kairos/luet (fix-version)$ ./luet version
0.35.1-dirty
~/workspace/kairos/luet (fix-version)$ ./luet -v
luet version 0.35.1-dirty (Build time: 2024-03-21 08:05:33 UTC)
| import "github.com/mudler/luet/cmd" | ||
|
|
||
| var ( | ||
| version 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.
wasn't used anywhere
mudler
left a comment
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.
Thanks!
and add a
versioncommand that only prints the version (without the build time)Fixes: kairos-io/kairos#2370