Why are you trying to do that? It feels like you're trying to do object-oriented programming in Go. Don't do that. What are you trying to achieve that the *template.Template type doesn't allow?
If you just want a template with a FuncMap already applied, write a function to do that: func MyTemplate(name string) *template.Template { return template.New(name).Funcs(map[string]interface{}{"title": strings.Title}) } On Thu, Jul 6, 2017 at 8:01 PM Tong Sun <suntong...@gmail.com> wrote: > I'm trying my best to make the following Go template FuncMap example works: > > https://play.golang.org/p/1-JYseLBUF > > If I comment out line 55, 56 and un-comment line 54, it works just fine. > > What I was trying to do is to un-comment line 31, and use DefaultFuncs() > or something alike to replace line 54. I.e., I'm trying to wrap > the myFuncMap into a callable function. > > How can I do that? Thx > > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.