Split first then trim

This commit is contained in:
erik 2024-05-08 10:29:11 +02:00
parent 0f7841b715
commit bd235e4f8e

View file

@ -59,11 +59,11 @@ func (kv *k8sVersionValue) UnmarshalText(v []byte) error {
} }
func splitCSV(csvStr string) map[string]struct{} { func splitCSV(csvStr string) map[string]struct{} {
sanitizedValues := strings.ReplaceAll(csvStr, " ", "") splitValues := strings.Split(csvStr, ",")
splitValues := strings.Split(sanitizedValues, ",")
valuesMap := map[string]struct{}{} valuesMap := map[string]struct{}{}
for _, kind := range splitValues { for _, kind := range splitValues {
kind = strings.TrimSpace(kind)
if len(kind) > 0 { if len(kind) > 0 {
valuesMap[kind] = struct{}{} valuesMap[kind] = struct{}{}
} }