1
0
mirror of https://github.com/rancher/os.git synced 2025-07-05 02:56:13 +00:00

use SplitN instead of manual split

This commit is contained in:
Ivan Mikushin 2015-04-30 13:43:45 +05:00
parent d62eb3de5d
commit 38167f821b

View File

@ -314,9 +314,8 @@ func Map2KVPairs(m map[string]string) []string {
func KVPairs2Map(kvs []string) map[string]string {
r := make(map[string]string, len(kvs))
for _, kv := range kvs {
sepIdx := strings.Index(kv, "=")
k, v := kv[:sepIdx], kv[(sepIdx + 1):]
r[k] = v
s := strings.SplitN(kv, "=", 2)
r[s[0]] = s[1]
}
return r
}