runconfig/opts: use strings.Cut()

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2022-11-01 12:47:46 +01:00
parent bffb35612c
commit ff447f4fd5
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C

View file

@ -8,12 +8,8 @@ import (
func ConvertKVStringsToMap(values []string) map[string]string {
result := make(map[string]string, len(values))
for _, value := range values {
kv := strings.SplitN(value, "=", 2)
if len(kv) == 1 {
result[kv[0]] = ""
} else {
result[kv[0]] = kv[1]
}
k, v, _ := strings.Cut(value, "=")
result[k] = v
}
return result