use switch instead of if else conditions

This commit is contained in:
Mothiki 2017-08-22 17:03:35 -07:00
parent dcab5e698f
commit 4bc0a694ae

View file

@ -82,16 +82,17 @@ func (m *Monitor) JobUpdate(updateKey aurora.JobUpdateKey, interval int, timeout
// Rolled forward is the only state in which an update has been successfully updated
// if we encounter an inactive state and it is not at rolled forward, update failed
if status == aurora.JobUpdateStatus_ROLLED_FORWARD {
switch status {
case aurora.JobUpdateStatus_ROLLED_FORWARD:
fmt.Println("Update succeded")
return true, nil
} else if status == aurora.JobUpdateStatus_FAILED {
case aurora.JobUpdateStatus_FAILED:
fmt.Println("Update failed")
return false, errors.New(UpdateFailed)
} else if status == aurora.JobUpdateStatus_ROLLED_BACK {
case aurora.JobUpdateStatus_ROLLED_BACK:
fmt.Println("rolled back")
return false, errors.New(RolledBack)
} else {
default:
return false, nil
}
}