Skip to content

Commit 94202ce

Browse files
add: changes
1 parent 1e1d0ee commit 94202ce

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

‎cmd/root.go‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ package cmd
66
import (
77
"fmt"
88
"os"
9+
"runtime/debug"
910

1011
"github.com/spf13/cobra"
1112
)
@@ -38,13 +39,22 @@ func Execute() {
3839
}
3940
}
4041

42+
func resolvedVersion() string {
43+
if info, ok := debug.ReadBuildInfo(); ok {
44+
if info.Main.Version != "(devel)" {
45+
return info.Main.Version
46+
}
47+
}
48+
return Version
49+
}
50+
4151
func init() {
4252
rootCmd.Flags().BoolP("version", "v", false, "print version information")
4353

4454
rootCmd.SetVersionTemplate(
4555
fmt.Sprintf(
4656
"bootstrap-cli %s\nCommit: %s\nBuilt: %s\n",
47-
Version,
57+
resolvedVersion(),
4858
Commit,
4959
Date,
5060
),

0 commit comments

Comments
 (0)