package main import ( "fmt" "log" "net/http" "text/template" ) type Server struct { template *template.Template } func (c *Server) rootHandle(w http.ResponseWriter, r * http.Request) { tmpl, err := template.ParseFiles("templates/index.html") if err != nil { log.Println(err) return } tmpl.Execute(w, nil) } func main() { fmt.Println("Hello world!") template, err := template.ParseFS(templates, "templates/*.html") if err != nil { log.Fatal(err) } s := Server { template: template, } http.HandleFunc("/", s.rootHandle) log.Fatal(http.ListenAndServe(":8080", nil)) }