func Home(w http.ResponseWriter, r *staticAuth.AuthenticatedRequest) {
t, err := template.ParseFiles("index.html") //parse the html file homepage.html
if err != nil { // if there is an error
log.Print("template parsing error: ", err) // log it
}
err = t.Execute(w, nil) //execute the template and pass it the HomePageVars struct to fill in the gaps
if err != nil { // if there is an error
log.Print("template executing error: ", err) //log it
}
}
答案 0 :(得分:1)
gtkterm
在您的代码中,您检查并记录错误,然后继续并忽略错误。