You do not need to create a new template with Newand then use ParseFiles. There is also a feature ParseFilesthat takes care of creating a new template backstage.
Here is an example:
package main
import (
"fmt"
"html/template"
"os"
)
func main() {
t, err := template.ParseFiles("test.html")
if err != nil {
fmt.Println(err);
}
t.Execute(os.Stdout, nil)
}
user11617
source
share