diff options
| author | Dave Henderson <dhenderson@gmail.com> | 2017-08-05 13:21:05 -0400 |
|---|---|---|
| committer | Dave Henderson <dhenderson@gmail.com> | 2017-08-09 21:51:07 -0400 |
| commit | 51ddb6e800ab087fa3dff19686b0f1f39a1a4432 (patch) | |
| tree | 1892e841efa720c2cc387cd0de7f9c1b6d318c63 /gomplate.go | |
| parent | dd5a7e412352f2e268973b428648cca6e549dc83 (diff) | |
Extracting data namespace, renaming typeconv to conv namespace
Signed-off-by: Dave Henderson <dhenderson@gmail.com>
Diffstat (limited to 'gomplate.go')
| -rw-r--r-- | gomplate.go | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/gomplate.go b/gomplate.go index 71530368..25e2a317 100644 --- a/gomplate.go +++ b/gomplate.go @@ -4,6 +4,8 @@ import ( "io" "log" "text/template" + + "github.com/hairyhenderson/gomplate/data" ) func (g *Gomplate) createTemplate() *template.Template { @@ -31,19 +33,20 @@ func (g *Gomplate) RunTemplate(text string, out io.Writer) { } // NewGomplate - -func NewGomplate(data *Data, leftDelim, rightDelim string) *Gomplate { +func NewGomplate(d *data.Data, leftDelim, rightDelim string) *Gomplate { return &Gomplate{ leftDelim: leftDelim, rightDelim: rightDelim, - funcMap: initFuncs(data), + funcMap: initFuncs(d), } } func runTemplate(o *GomplateOpts) error { defer runCleanupHooks() - data := NewData(o.dataSources, o.dataSourceHeaders) + d := data.NewData(o.dataSources, o.dataSourceHeaders) + addCleanupHook(d.Cleanup) - g := NewGomplate(data, o.lDelim, o.rDelim) + g := NewGomplate(d, o.lDelim, o.rDelim) if o.inputDir != "" { return processInputDir(o.inputDir, o.outputDir, g) |
