handle single kv pair given to NewMeta

This commit is contained in:
Bradley Cicenas 2020-01-03 12:07:21 +00:00
parent 22a5607012
commit 50d1c29d57
No known key found for this signature in database
GPG Key ID: AF579ED4B93CBB5C
1 changed files with 4 additions and 8 deletions

View File

@ -14,14 +14,10 @@ type Meta map[string]string
func NewMeta(kvs ...string) Meta {
m := make(Meta)
var k string
for i := 0; i < len(kvs)-1; i++ {
if k == "" {
k = kvs[i]
} else {
m[k] = kvs[i]
k = ""
}
var i int
for i < len(kvs)-1 {
m[kvs[i]] = kvs[i+1]
i += 2
}
return m