Skip to content

Commit bcfd723

Browse files
committed
Simplified hasLabel
1 parent 31d0834 commit bcfd723

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

cmd/backup/stop_restart.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,8 @@ func isSwarm(c interface {
9292
}
9393

9494
func hasLabel(labels map[string]string, key, value string) bool {
95-
if val, ok := labels[key]; ok {
96-
if val == value {
97-
return true
98-
}
99-
}
100-
return false
95+
val, ok := labels[key]
96+
return ok && val == value
10197
}
10298

10399
func checkStopLabels(labels map[string]string, stopDuringBackupLabelValue string, stopDuringBackupNoRestartLabelValue string) (bool, bool, error) {

0 commit comments

Comments
 (0)