diff --git a/cmd/backup/stop_restart.go b/cmd/backup/stop_restart.go index a94b7b1..6a6bb74 100644 --- a/cmd/backup/stop_restart.go +++ b/cmd/backup/stop_restart.go @@ -92,12 +92,8 @@ func isSwarm(c interface { } func hasLabel(labels map[string]string, key, value string) bool { - if val, ok := labels[key]; ok { - if val == value { - return true - } - } - return false + val, ok := labels[key] + return ok && val == value } func checkStopLabels(labels map[string]string, stopDuringBackupLabelValue string, stopDuringBackupNoRestartLabelValue string) (bool, bool, error) {