getBuildDate() should be time.Time and handle it gracefully

This commit is contained in:
Harshavardhana
2015-04-29 00:04:28 -07:00
parent 05aff42f7f
commit 8d68154498
2 changed files with 7 additions and 8 deletions
+3 -4
View File
@@ -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")
+4 -4
View File
@@ -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 {