From 20c36c7d33b11756b530ba4147e86515249eb6d9 Mon Sep 17 00:00:00 2001 From: Henning Surmeier Date: Wed, 15 Nov 2023 17:44:09 +0100 Subject: [PATCH] don't use parseFiles on existing template the old code would create a new empty template. ParseFiles would then do the same, and discard the parsed template if the original template is already initialized. --- pkg/files/render.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/files/render.go b/pkg/files/render.go index 8b57c2b..decca17 100644 --- a/pkg/files/render.go +++ b/pkg/files/render.go @@ -61,11 +61,12 @@ func renderFile(cfg *config.File) error { log.Infof("creating configuration file %s from template %s", cfg.Target, cfg.Template) - tpl, err := newTemplate(cfg.Target).ParseFiles(cfg.Template) + tplContents, err := os.ReadFile(cfg.Template) if err != nil { return err } + tpl, err := template.New(cfg.Target).Parse(string(tplContents)) folderPath, err := filepath.Abs(filepath.Dir(cfg.Target)) if err != nil { return err