Use goreleaser version if available, otherwise buildinfo

This commit is contained in:
Samuel Lorch 2024-04-05 21:45:57 +02:00
parent b269e8538d
commit b48f3274e6
3 changed files with 48 additions and 6 deletions

View file

@ -121,6 +121,10 @@ func initConfig() {
}
}
func SetVersionInfo(version, commit, date string) {
rootCmd.Version = fmt.Sprintf("%s (Built on %s from Git SHA %s)", version, date, commit)
func SetVersionInfo(version, commit, date string, dirty bool) {
v := fmt.Sprintf("%s (Built on %s from Git SHA %s)", version, date, commit)
if dirty {
v = v + " dirty"
}
rootCmd.Version = v
}