From 3beea4fb9430b3207a9fc0020ccf8ca94dfea39d Mon Sep 17 00:00:00 2001 From: Adrien Delorme Date: Tue, 17 Mar 2020 11:59:54 +0100 Subject: [PATCH] NameValues.CopyOn: don't instanciate a receiving map if there is nothing to copy over --- hcl2template/types.kv.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hcl2template/types.kv.go b/hcl2template/types.kv.go index faf8a2a27..cd1e63007 100644 --- a/hcl2template/types.kv.go +++ b/hcl2template/types.kv.go @@ -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{} }