This structure is just an example. You can also pass the structure from the outside, or you could use the map as you intended. The structure is good because the type of structure can document which fields the template expects, but this is not required.
All of them should work:
func View(w http.ResponseWriter, info Info) { temp.ExecuteTemplate(w, temp.Name(), &info) }
func View(w http.ResponseWriter, info *Info) { temp.ExecuteTemplate(w, temp.Name(), info) }
func View(w http.ResponseWriter, info map[string]interface{}) { temp.ExecuteTemplate(w, temp.Name(), info) }
source share