我是 Go 的初学者,我不明白在函数流中写入数据“home.html”的调用在哪里Execute
。http.ResponseWriter 是很清楚但在函数中Execute
我看不到像write .. fmt.Fprint..
我这样的任何东西看递归Execute
http://golang.org/src/pkg/html/template/template.go?s=1245:1315#L40
//my Function
func homeHandler(c http.ResponseWriter, req *http.Request) {
var homeTempl = template.Must(template.ParseFiles("home.html"))
//here is my misunderstanding
homeTempl.Execute(c, req.Host)
//Thats consistent
fmt.Fprint(c, "hallo")
}