getBuildDate() should be time.Time and handle it gracefully
This commit is contained in:
+3
-4
@@ -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")
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user