package main import ( "html/template" "net/http" "time" ) type indexData struct { Time string } func handleRoot(w http.ResponseWriter, r *http.Request) { tmpl, err := template.ParseFS(embed_templates, "templates/index.html") if err != nil { http.Error(w, "Couldn't parse template file", http.StatusInternalServerError) return } err = tmpl.Execute(w, indexData{Time: time.Now().Format(time.Stamp)}) if err != nil { http.Error(w, "Failed to execute template", http.StatusInternalServerError) } }