Print go version

This commit is contained in:
Ken-Håvard Lieng 2018-12-15 11:30:29 +01:00
parent 6a816fbff6
commit c5a9a5b1c1
2 changed files with 5 additions and 2 deletions

View File

@ -5,6 +5,7 @@ import (
"io/ioutil" "io/ioutil"
"log" "log"
"os" "os"
"runtime"
"github.com/khlieng/dispatch/assets" "github.com/khlieng/dispatch/assets"
"github.com/khlieng/dispatch/config" "github.com/khlieng/dispatch/config"
@ -28,6 +29,7 @@ const logo = `
%s %s
Commit: %s Commit: %s
Build Date: %s Build Date: %s
Runtime: %s
` `
@ -41,7 +43,7 @@ var rootCmd = &cobra.Command{
} }
if cmd == cmd.Root() { if cmd == cmd.Root() {
fmt.Printf(logo, version.Tag, version.Commit, version.Date) fmt.Printf(logo, version.Tag, version.Commit, version.Date, runtime.Version())
} }
storage.Initialize(viper.GetString("dir")) storage.Initialize(viper.GetString("dir"))

View File

@ -2,6 +2,7 @@ package commands
import ( import (
"fmt" "fmt"
"runtime"
"github.com/khlieng/dispatch/version" "github.com/khlieng/dispatch/version"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -17,5 +18,5 @@ var versionCmd = &cobra.Command{
} }
func printVersion() { func printVersion() {
fmt.Printf("%s\nCommit: %s\nBuild Date: %s\n", version.Tag, version.Commit, version.Date) fmt.Printf("%s\nCommit: %s\nBuild Date: %s\nRuntime: %s\n", version.Tag, version.Commit, version.Date, runtime.Version())
} }