From 5bd39f8e6591bbe9180e5c953cafafea09bc25d8 Mon Sep 17 00:00:00 2001 From: Kenjiro Nakayama Date: Thu, 4 Aug 2016 18:42:13 +0900 Subject: [PATCH] fix go panic --- command/data_format.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/command/data_format.go b/command/data_format.go index 1111ca0ce..492562941 100644 --- a/command/data_format.go +++ b/command/data_format.go @@ -49,8 +49,12 @@ func (p *TemplateFormat) TransformData(data interface{}) (string, error) { return "", fmt.Errorf("template needs to be specified the golang templates.") } - t := template.Must(template.New("format").Parse(p.tmpl)) - err := t.Execute(out, data) + t, err := template.New("format").Parse(p.tmpl) + if err != nil { + return "", err + } + + err = t.Execute(out, data) if err != nil { return "", err }