Merge pull request #645 from vbatts/kpod-version-failsafe

kpod: version should not fail
This commit is contained in:
Mrunal Patel 2017-07-11 07:30:15 -07:00 committed by GitHub
commit d270de78c4

View file

@ -17,19 +17,20 @@ var (
// versionCmd gets and prints version info for version command // versionCmd gets and prints version info for version command
func versionCmd(c *cli.Context) error { func versionCmd(c *cli.Context) error {
fmt.Println("Version: ", Version)
fmt.Println("Go Version: ", runtime.Version())
if gitCommit != "" {
fmt.Println("Git Commit: ", gitCommit)
}
if buildInfo != "" {
// Converts unix time from string to int64 // Converts unix time from string to int64
buildTime, err := strconv.ParseInt(buildInfo, 10, 64) buildTime, err := strconv.ParseInt(buildInfo, 10, 64)
if err != nil { if err != nil {
return err return err
} }
fmt.Println("Version: ", Version)
fmt.Println("Go Version: ", runtime.Version())
fmt.Println("Git Commit: ", gitCommit)
// Prints out the build time in readable format // Prints out the build time in readable format
fmt.Println("Built: ", time.Unix(buildTime, 0).Format(time.ANSIC)) fmt.Println("Built: ", time.Unix(buildTime, 0).Format(time.ANSIC))
}
fmt.Println("OS/Arch: ", runtime.GOOS+"/"+runtime.GOARCH) fmt.Println("OS/Arch: ", runtime.GOOS+"/"+runtime.GOARCH)
return nil return nil