Fix TemplateService helpers initialization

This commit is contained in:
wpetit 2018-12-06 22:07:05 +01:00
parent d83508c769
commit 100cf83917
1 changed files with 3 additions and 0 deletions

View File

@ -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
}
}