func templateHandler(template *template.Template, data interface{}, log log.Logger) http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		name := r.URL.Path[1:] // ignore leading slash
		var buf bytes.Buffer
		if err := template.ExecuteTemplate(&buf, name, data); err != nil {
			err = fmt.Errorf("rendering template: %v", err)
			writeInternalError(err, log, w)
		}
		w.Write(buf.Bytes())
	}
}
// templateHandler servers the file from the data-driven template.  The name is assumed to have a leading slash that is ignored.
// Templates are written a buffer to ensure they execute correctly before they are written to the response
templateHandler servers the file from the data-driven template.  The name is assumed to have a leading slash that is ignored.
Templates are written a buffer to ensure they execute correctly before they are written to the response
// templateHandler servers the file from the data - driven template . The name is assumed to have a leading slash that is ignored . // Templates are written a buffer to ensure they execute correctly before they are written to the response
func templateHandler(template *template.Template, data interface{}, log log.Logger) http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		name := r.URL.Path[1:] 
		var buf bytes.Buffer
		if err := template.ExecuteTemplate(&buf, name, data); err != nil {
			err = fmt.Errorf("rendering template: %v", err)
			writeInternalError(err, log, w)
		}
		w.Write(buf.Bytes())
	}
}
func templateHandler ( template * template . Template , data interface { } , log log . Logger ) http . HandlerFunc { return func ( w http . ResponseWriter , r * http . Request ) { name := r . URL . Path [ 1 : ] var buf bytes . Buffer if err := template . ExecuteTemplate ( & buf , name , data ) ; err != nil { err = fmt . Errorf ( " " , err ) writeInternalError ( err , log , w ) } w . Write ( buf . Bytes ( ) ) } }
templateHandler servers the file from the data-driven template.
templateHandler servers the file from the data - driven template .
// ignore leading slash