mirror of
https://github.com/yannh/kubeconform.git
synced 2026-02-18 09:27:02 +00:00
Split first then trim
This commit is contained in:
parent
0f7841b715
commit
bd235e4f8e
1 changed files with 2 additions and 2 deletions
|
|
@ -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{}{}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue