Pass version information via ldflags (#43)

This commit is contained in:
2021-03-30 12:38:28 +02:00
committed by GitHub
parent 09d0ffc9dc
commit 29b51fdf61
4 changed files with 47 additions and 30 deletions

View File

@@ -1,6 +1,7 @@
package cmd
import (
"fmt"
"path/filepath"
"github.com/apex/log"
@@ -10,6 +11,9 @@ import (
)
var cfgFile string
var version string
var commit string
var date string
//Execute runs the root command
func Execute() {
@@ -17,7 +21,7 @@ func Execute() {
var rootCmd = &cobra.Command{
Use: "speedrun",
Short: "Cloud first command execution",
Version: "0.1.0",
Version: fmt.Sprintf("%s, commit: %s, date: %s", version, commit, date),
}
rootCmd.AddCommand(initCmd)