mirror of
https://github.com/mainnika/nikita-tokarch-uk.git
synced 2026-05-25 01:03:35 +00:00
Funcs that panic on purpose should be named properly
This commit is contained in:
@@ -25,7 +25,7 @@ func (tw *TemplateWriter) SetHeader(rh *fasthttp.ResponseHeader) {
|
|||||||
// Write executes the template and writes result to the response writer
|
// Write executes the template and writes result to the response writer
|
||||||
func (tw *TemplateWriter) Write(w io.Writer, content interface{}) error {
|
func (tw *TemplateWriter) Write(w io.Writer, content interface{}) error {
|
||||||
|
|
||||||
template := templates.GetTemplateOf(content)
|
template := templates.MustGetTemplateOf(content)
|
||||||
|
|
||||||
return template.Execute(w, content)
|
return template.Execute(w, content)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,8 +72,8 @@ func MustLookup(name string) *template.Template {
|
|||||||
return tmpl
|
return tmpl
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetTemplateOf returns template which is mapped to the content data
|
// MustGetTemplateOf returns template which is mapped to the content data
|
||||||
func GetTemplateOf(content interface{}) (template *template.Template) {
|
func MustGetTemplateOf(content interface{}) (template *template.Template) {
|
||||||
|
|
||||||
el := reflect.TypeOf(content)
|
el := reflect.TypeOf(content)
|
||||||
numField := el.NumField()
|
numField := el.NumField()
|
||||||
|
|||||||
Reference in New Issue
Block a user