From 11b42dce568d9cef1d4e7c2d9b77408ffdba5815 Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Sat, 25 May 2019 17:10:56 +0200 Subject: [PATCH] Check for template errors Signed-off-by: Knut Ahlers --- main.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index e50af93..3a3c83f 100644 --- a/main.go +++ b/main.go @@ -99,10 +99,12 @@ func main() { log.WithError(err).Fatal("Unable to parse template") } - tpl.Execute(os.Stdout, map[string]interface{}{ + if err := tpl.Execute(os.Stdout, map[string]interface{}{ "roots": rootServers, "version": version, - }) + }); err != nil { + log.WithError(err).Fatal("Unable to generate stub file") + } } func setRootsFromTLDs(roots map[string][]string, rootsMutex *sync.Mutex, tlds []string, filter []string, resolver func(string) ([]string, error), wg *sync.WaitGroup, cLimiter chan struct{}) {