package pkg import ( "html/template" "io" "net/http" ) func renderTemplate(wr io.Writer, r *http.Request, filename string, data interface{}) { locale := getLocale(r) t := template.New(filename) t.Funcs(template.FuncMap{ "gettext": locale.Get, "pgettext": locale.GetC, }) if _, err := t.ParseFiles("web/template/" + filename); err != nil { panic(err) } if err := t.Execute(wr, data); err != nil { panic(err) } }