diff --git a/cmd-update.go b/cmd-update.go index 3f81e056..ff6e71fd 100644 --- a/cmd-update.go +++ b/cmd-update.go @@ -84,10 +84,9 @@ func runUpdateCmd(ctx *cli.Context) { log.Debug.Println(iodine.New(err, nil)) console.Fatalln("Unable to parse update time:", results.LatestBuild) } - current, err := time.Parse(time.RFC3339Nano, ctx.App.Compiled) - if err != nil { - log.Debug.Println(iodine.New(err, nil)) - console.Fatalln("Unable to parse update time:", current) + current := getBuildDate() + if current.IsZero() { + console.Fatalln("BuildDate is zero, must be a wrong build exiting..") } if latest.After(current) { printUpdateNotify("new", "old") diff --git a/main.go b/main.go index 4a4a8548..73bd5a24 100644 --- a/main.go +++ b/main.go @@ -57,12 +57,12 @@ func checkConfig() { var BuildDate string // getBuildDate - -func getBuildDate() string { +func getBuildDate() time.Time { if BuildDate == "" { - return "" + return time.Time{} } t, _ := time.Parse(time.RFC3339Nano, BuildDate) - return t.String() + return t } // Get os/arch/platform specific information. @@ -99,7 +99,7 @@ func main() { app.Usage = "Minio Client for object storage and filesystems" app.Version = Version app.Commands = commands - app.Compiled = getBuildDate() + app.Compiled = getBuildDate().Format(time.RFC1123) app.Flags = flags app.Author = "Minio.io" app.Before = func(ctx *cli.Context) error {