From b6d9adf294834ea37649320a66a1567d6872b79c Mon Sep 17 00:00:00 2001 From: Alex Pana <8968914+acpana@users.noreply.github.com> Date: Wed, 11 Dec 2024 00:09:39 +0000 Subject: [PATCH] refactor: return pointer to false Signed-off-by: Alex Pana <8968914+acpana@users.noreply.github.com> --- pkg/controller/direct/maputils.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/controller/direct/maputils.go b/pkg/controller/direct/maputils.go index 34ba5a03f5..199990471b 100644 --- a/pkg/controller/direct/maputils.go +++ b/pkg/controller/direct/maputils.go @@ -167,6 +167,12 @@ func EnumSlice_FromProto[U ProtoEnum](mapCtx *MapContext, in []U) []string { func LazyPtr[V comparable](v V) *V { var defaultV V if v == defaultV { + // Special handling for booleans + if b, ok := any(v).(bool); ok && !b { + // Return a pointer to a false boolean instead of nil + return &v + } + // For all other zero-value types, return nil return nil } return &v