Skip to content

Commit 3598968

Browse files
authored
Fix uniq args func (#1138)
Signed-off-by: Alexey Makhov <[email protected]> Signed-off-by: makhov <[email protected]>
1 parent 6cd3e4a commit 3598968

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

internal/controller/controlplane/helper.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,12 @@ func normalizeK0sConfigSpec(kcp *cpv1beta1.K0sControlPlane, bootstrapConfig boot
609609
}
610610

611611
func uniqueArgs(args []string) []string {
612+
// DO NOT REMOVE THIS CHECK
613+
// If the slice is empty, we return the slice as is to avoid any modifications.
614+
// In callers, we may compare slices and in some cases it may end up in comparing empty and nil slices.
615+
if len(args) == 0 {
616+
return args
617+
}
612618
uniqueArgsSlice := []string{}
613619
uniqueArgsMap := make(map[string]struct{})
614620
for _, arg := range args {

0 commit comments

Comments
 (0)