templates/templates.go
func (t Templates) RespondWithStatus(w http.ResponseWriter, name string, data interface{}, status int) {
	buf := bytes.Buffer{}
	tpl, ok := t.templates[name]
	if !ok {
		panic(&Error{Err: ErrUnknownTemplate, Template: name})
	}
	if err := tpl.Execute(&buf, data); err != nil {
		panic(err)
	}
	if t.contentType != "" {
		w.Header().Set("Content-Type", t.contentType)
	}
	if status > 0 {
		w.WriteHeader(status)
	}
	if _, err := buf.WriteTo(w); err != nil {
		t.logf("respond %q: %v", name, err)
	}
}
func (t Templates) RespondWithStatus(w http.ResponseWriter, name string, data interface{}, status int) {
	buf := bytes.Buffer{}
	tpl, ok := t.templates[name]
	if !ok {
		panic(&Error{Err: ErrUnknownTemplate, Template: name})
	}
	if err := tpl.Execute(&buf, data); err != nil {
		panic(err)
	}
	if t.contentType != "" {
		w.Header().Set("Content-Type", t.contentType)
	}
	if status > 0 {
		w.WriteHeader(status)
	}
	if _, err := buf.WriteTo(w); err != nil {
		t.logf("respond %q: %v", name, err)
	}
}
// RespondWithStatus executes a template with provided data into buffer,
// then writes the the status and body to the response writer.
// A panic will be raised if the template does not exist or fails to execute.