From bcfd7230aefdd2b7aeed51f8e3fcb75829c899ed Mon Sep 17 00:00:00 2001 From: Jean Michel Moll Date: Tue, 28 Oct 2025 21:43:34 +0100 Subject: [PATCH] Simplified `hasLabel` --- cmd/backup/stop_restart.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) 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) {