Fix TemplateService helpers initialization
This commit is contained in:
parent
d83508c769
commit
100cf83917
|
@ -33,6 +33,9 @@ func WithDefaultHelpers() OptionFunc {
|
||||||
// to expose the default helpers
|
// to expose the default helpers
|
||||||
func WithHelper(name string, fn interface{}) OptionFunc {
|
func WithHelper(name string, fn interface{}) OptionFunc {
|
||||||
return func(opts *Options) {
|
return func(opts *Options) {
|
||||||
|
if opts.Helpers == nil {
|
||||||
|
opts.Helpers = make(template.FuncMap)
|
||||||
|
}
|
||||||
opts.Helpers[name] = fn
|
opts.Helpers[name] = fn
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue