Fix and cleanup update message and improve related tests (#4361)

Fixes #4232
This commit is contained in:
Aditya Manthramurthy
2017-05-31 09:22:00 -07:00
committed by Harshavardhana
parent 28352f3f5d
commit a0e02f43e1
4 changed files with 106 additions and 48 deletions

View File

@@ -81,8 +81,8 @@ EXAMPLES:
func checkUpdate(mode string) {
// Its OK to ignore any errors during getUpdateInfo() here.
if older, downloadURL, err := getUpdateInfo(1*time.Second, mode); err == nil {
if older > time.Duration(0) {
log.Println(colorizeUpdateMessage(downloadURL, older))
if updateMsg := computeUpdateMessage(downloadURL, older); updateMsg != "" {
log.Println(updateMsg)
}
}
}