package main import ( "fmt" "log" "net/http" "text/template" ) type Film struct { Title string Director string } func main() { fmt.Println("hello world") h1 := func(w http.ResponseWriter, r *http.Request) { tmpl := template.Must(template.ParseFiles("index.html")) films := map[string][]Film{ "Films": { {Title: "The Goodfather", Director: "Francis Ford Coppola"}, {Title: "Blade Runner", Director: "Ridley Scott"}, {Title: "The Thing", Director: "John Carpenter"}, }, } tmpl.Execute(w, films) } http.HandleFunc("/", h1) log.Fatal(http.ListenAndServe(":8000", nil)) }