Skip to content

Commit

Permalink
don't use parseFiles on existing template
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
hensur committed Nov 15, 2023
1 parent b6f2512 commit 20c36c7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/files/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 20c36c7

Please sign in to comment.