I am right now doing like this.
t := template.ParseGlob("./templates/*.html)
//somewhere (getting this t and passing to http router)
t.ExecuteTemplate(w, "index.html", data)
I am thinking that ParseGlob will parse all the template files at once. So everything will be parsed and be ready to be served when called by the ExecuteTemplate.
Instead of creating the template variable “t”
//I can write in the following way.
//on index router
t := template.ParseFiles("./templates/index.html)
t.Execute(w, data)
On every router, I have to parse the required files.
Which one is efficient?