From 4574ec8568ebdd75153cd087b77c6ed37de34cab Mon Sep 17 00:00:00 2001 From: Owen Smith Date: Tue, 29 Nov 2016 16:48:57 +0000 Subject: [PATCH] Don't swallow execution errors --- main.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 8c661f8..e402378 100644 --- a/main.go +++ b/main.go @@ -5,6 +5,7 @@ import "bytes" import "errors" import "io" import "os" +import "log" import "text/template" import "strings" @@ -30,9 +31,12 @@ func WriteTemplateToStream(tplSource string, environ map[string]string, outStrea }) _, err := tpl.Parse(tplSource) if err != nil { - panic(err) + log.Fatal(err) + } + err = tpl.Execute(outStream, environ) + if err != nil { + log.Fatal(err) } - tpl.Execute(outStream, environ) } func TplSplitStr(args ...interface{}) ([]string, error) {