NameValues.CopyOn: don't instanciate a receiving map if there is nothing to copy over

This commit is contained in:
Adrien Delorme
2020-03-17 12:00:23 +01:00
parent b15c92bc1e
commit 3beea4fb94
+3
View File
@@ -10,6 +10,9 @@ type NameValue struct {
type NameValues []NameValue
func (kvs NameValues) CopyOn(to *map[string]string) []error {
if len(kvs) == 0 {
return nil
}
if *to == nil {
*to = map[string]string{}
}