about summary refs log tree commit diff
path: root/templater/templater.go
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@gmail.com>2017-02-10T19·53+0100
committerVincent Ambo <tazjin@gmail.com>2017-02-14T18·12+0100
commitf81fe551bcf1baa1167ed237c7120df69cf2ddab (patch)
tree716411b99c9e3ec3fab09f449729ee2030f6ae85 /templater/templater.go
parent7a930aad113703ae3a829bbc1253d218c89f1f20 (diff)
chore templater: Use new util.Merge func
Diffstat (limited to 'templater/templater.go')
-rw-r--r--templater/templater.go13
1 files changed, 2 insertions, 11 deletions
diff --git a/templater/templater.go b/templater/templater.go
index 5e38ddf893..e6f8a92ee3 100644
--- a/templater/templater.go
+++ b/templater/templater.go
@@ -13,6 +13,7 @@ import (
 	"github.com/Masterminds/sprig"
 	"github.com/polydawn/meep"
 	"github.com/tazjin/kontemplate/context"
+	"github.com/tazjin/kontemplate/util"
 )
 
 // Error that is caused by non-existent template files being specified
@@ -88,17 +89,7 @@ func templateFile(c *context.Context, rs *context.ResourceSet, filename string)
 
 	var b bytes.Buffer
 
-	// Guard against empty map before merging keys
-	if rs.Values == nil {
-		rs.Values = make(map[string]interface{}, 0)
-	}
-
-	// Merge global and resourceset-specific values (don't override from global)
-	for k, v := range c.Global {
-		if _, ok := rs.Values[k]; !ok {
-			rs.Values[k] = v
-		}
-	}
+	rs.Values = *util.Merge(&c.Global, &rs.Values)
 
 	err = tpl.Execute(&b, rs.Values)