mirror of
https://github.com/vmware-tanzu/pinniped.git
synced 2026-01-03 19:54:24 +00:00
Refactor branching logic when using an early return
This commit is contained in:
@@ -67,11 +67,12 @@ func mergeCondition(existingConditionsToUpdate *[]metav1.Condition, newCondition
|
||||
// If there is no existing condition of this type, append this one and we're done.
|
||||
*existingConditionsToUpdate = append(*existingConditionsToUpdate, *newCondition)
|
||||
return true
|
||||
} else {
|
||||
existingCondition = &(*existingConditionsToUpdate)[index]
|
||||
}
|
||||
|
||||
// Set the LastTransitionTime depending on whether the status has changed.
|
||||
// Get a pointer to the existing condition
|
||||
existingCondition = &(*existingConditionsToUpdate)[index]
|
||||
|
||||
// If the status has not changed, preserve the original lastTransitionTime
|
||||
if newCondition.Status == existingCondition.Status {
|
||||
newCondition.LastTransitionTime = existingCondition.LastTransitionTime
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user