Funcs that panic on purpose should be named properly

develop
Nikita Tokarchuk 3 years ago
parent 277686086e
commit 8e87eb0adf
Signed by: mainnika
GPG Key ID: A595FB7E3E56911C
  1. 2
      pkg/routes/output.go
  2. 4
      pkg/templates/templates.go

@ -25,7 +25,7 @@ func (tw *TemplateWriter) SetHeader(rh *fasthttp.ResponseHeader) {
// Write executes the template and writes result to the response writer
func (tw *TemplateWriter) Write(w io.Writer, content interface{}) error {
template := templates.GetTemplateOf(content)
template := templates.MustGetTemplateOf(content)
return template.Execute(w, content)
}

@ -72,8 +72,8 @@ func MustLookup(name string) *template.Template {
return tmpl
}
// GetTemplateOf returns template which is mapped to the content data
func GetTemplateOf(content interface{}) (template *template.Template) {
// MustGetTemplateOf returns template which is mapped to the content data
func MustGetTemplateOf(content interface{}) (template *template.Template) {
el := reflect.TypeOf(content)
numField := el.NumField()

Loading…
Cancel
Save