From 100cf839173194760bb6dd70e79e551c7d8a7d0b Mon Sep 17 00:00:00 2001 From: William Petit Date: Thu, 6 Dec 2018 22:07:05 +0100 Subject: [PATCH] Fix TemplateService helpers initialization --- template/html/option.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/template/html/option.go b/template/html/option.go index 31df3e3..988fa3a 100644 --- a/template/html/option.go +++ b/template/html/option.go @@ -33,6 +33,9 @@ func WithDefaultHelpers() OptionFunc { // to expose the default helpers func WithHelper(name string, fn interface{}) OptionFunc { return func(opts *Options) { + if opts.Helpers == nil { + opts.Helpers = make(template.FuncMap) + } opts.Helpers[name] = fn } }