Skip to content

Commit 3587de4

Browse files
author
Ryan Lymburner
committed
Remove switch statement
1 parent e0e7a24 commit 3587de4

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

pkg/k8s/utils.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -165,15 +165,15 @@ func ValidateStandaloneAnnotation(obj client.Object) (bool, error) {
165165
}
166166

167167
// Check for valid values
168-
switch strings.ToLower(trimmed) {
169-
case "true":
168+
lowerValue := strings.ToLower(trimmed)
169+
if lowerValue == "true" {
170170
return true, nil
171-
case "false":
171+
} else if lowerValue == "false" {
172172
return false, nil
173-
default:
174-
// Invalid values are treated as false but we report the validation error
175-
return false, fmt.Errorf("invalid standalone annotation value '%s', expected 'true' or 'false'", trimmed)
176173
}
174+
175+
// Invalid values are treated as false but we report the validation error
176+
return false, fmt.Errorf("invalid standalone annotation value '%s', expected 'true' or 'false'", trimmed)
177177
}
178178

179179
// GetStandaloneModeForRouteWithValidation determines standalone mode with detailed validation.

0 commit comments

Comments
 (0)