ConvertKVStringsToMap converts ["key=value"] to {"key":"value"}
(values []string)
| 40 | |
| 41 | // ConvertKVStringsToMap converts ["key=value"] to {"key":"value"} |
| 42 | func ConvertKVStringsToMap(values []string) map[string]string { |
| 43 | result := make(map[string]string, len(values)) |
| 44 | for _, value := range values { |
| 45 | k, v, _ := strings.Cut(value, "=") |
| 46 | result[k] = v |
| 47 | } |
| 48 | |
| 49 | return result |
| 50 | } |
| 51 | |
| 52 | // ConvertKVStringsToMapWithNil converts ["key=value"] to {"key":"value"} |
| 53 | // but set unset keys to nil - meaning the ones with no "=" in them. |
no outgoing calls
no test coverage detected
searching dependent graphs…