Original post

This will take all your templates (found within the templates folder) and add them to your executable application at compile time – so it’s fast as it doesn’t have to read from file. You can call these templates with ExecuteTemplate and passing the file name as the second parameter.
If you’re using this with a web server, you can replace the os.Stdout with the net/http writer.
package main import ( “html/template” “log” “os” ) type Page struct { Title string } var templates = template.