func main()
package main
import{
"html/template"
.....
)
var tmpl = template.New("master")
func main() {
func init() {
_, err := tmpl.ParseGlob("templates/*.html")
if err != nil {
log.Fatalln("Error loading templates:", err)
}
....
}
In another package I write inside a function:
tmpl.ExecuteTemplate(w, "venue-index.html", res)
but I get an error
tmpl: undefined
I realise that there are other similar questions but the answers have not solved my problem. What am I doing wrong?