Skip to content

Conversation

@jimmykarily
Copy link
Contributor

and add a version command that only prints the version (without the build time)

Fixes: kairos-io/kairos#2370

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 }}"
Copy link
Contributor Author

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)"
Copy link
Contributor Author

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)
Copy link
Contributor Author

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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wasn't used anywhere

Copy link
Owner

@mudler mudler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@mudler mudler merged commit f3480f8 into mudler:master Mar 21, 2024
@jimmykarily jimmykarily deleted the fix-version branch March 21, 2024 08:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Latest image still has luet version 0.34.0

2 participants