From 7a1e814ed7e80f779fc2cebb5a492ff9cfd2a52d Mon Sep 17 00:00:00 2001 From: Mofizur Rahman Date: Mon, 7 Dec 2020 21:51:14 -0500 Subject: [PATCH] ignore template error --- .gitignore | 1 + main.go | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index fe49695..e6ddfd1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ /bin +.idea/ # Logs logs diff --git a/main.go b/main.go index 1360f3b..aa62f32 100644 --- a/main.go +++ b/main.go @@ -4,7 +4,6 @@ import ( "archive/zip" "bytes" "fmt" - "html/template" "io" "io/ioutil" "log" @@ -13,6 +12,7 @@ import ( "path/filepath" "strconv" "strings" + "text/template" "github.com/mitchellh/go-homedir" ) @@ -205,7 +205,12 @@ func ProcessFiles(folder string, data Data) error { } filecontent := string(b) - fileTemplate := template.Must(template.New("file").Parse(filecontent)) + fileTemplate, err := template.New("file").Parse(filecontent) + + if err != nil { + return nil + } + buf := new(bytes.Buffer) if err := fileTemplate.Execute(buf, data); err != nil {