From c60535ec2daed90b146c33ce87618bfef91ecedc Mon Sep 17 00:00:00 2001 From: Yash Mehrotra Date: Thu, 7 Mar 2024 15:50:41 +0530 Subject: [PATCH] chore: change key value to slice behavior --- collections/maps.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/collections/maps.go b/collections/maps.go index c994dfa..9927694 100644 --- a/collections/maps.go +++ b/collections/maps.go @@ -82,12 +82,11 @@ func KeyValueSliceToMap(in []string) map[string]string { for _, item := range in { splits := strings.SplitN(item, "=", 2) if len(splits) == 1 { - continue // ignore this item. not in a=b format + // For no keys, we add an empty string to match just the key + splits = append(splits, "") } - sanitized[strings.TrimSpace(splits[0])] = strings.TrimSpace(splits[1]) } - return sanitized }