hello, im building a go web app and facing an issue with Executing templates with custom functions
func CustomTemplateExecute(res http.ResponseWriter, req *http.Request, templateName string, data map[string]interface{}) { // Append common templates and data structs and execute template var funcMap = template.FuncMap{ "humanSize": humanSize, } t, _ := template.New("").Funcs(funcMap).ParseFiles(templates.BASE, templates.NOTIFICATIONS, templates.TICKER, templateName) if len(data) == 0 { data = make(map[string]interface{}) data["user"], _ = store.GetUser(context.Get(req, "userid").(string)) data["isadmin"] = store.IsAdmin(context.Get(req, "userid").(string)) } else { data["user"], _ = store.GetUser(context.Get(req, "userid").(string)) data["isadmin"] = store.IsAdmin(context.Get(req, "userid").(string)) } t.Execute(res, data) } func humanSize() string { return "Hello" } I get template is empty error, i have tried giving a name to template.new and its the same error. Any help is appreciated, thank you ! -- 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.