diff options
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 13 |
1 files changed, 9 insertions, 4 deletions
@@ -3,7 +3,7 @@ package main import ( "fmt" "http" - "template" + "exp/template" mysql "github.com/Philio/GoMySQL" "os" ) @@ -67,7 +67,7 @@ func playlist(w http.ResponseWriter, r *http.Request) { } if debug { - t, err := template.ParseFile("templates/p.html", nil) + t, err := template.ParseFile("templates/p.html") if err != nil { http.Error(w, err.String(), http.StatusInternalServerError) return @@ -88,8 +88,13 @@ func playlist(w http.ResponseWriter, r *http.Request) { func main() { templates = make(map[string]*template.Template) - for _, t:= range []string{"p"} { - templates[t] = template.MustParseFile("templates/" + t + ".html", nil) + for _, path := range []string{"p"} { + t, err := template.ParseFile("templates/" + path + ".html") + if err != nil { + fmt.Println(err) + return + } + templates[path] = t } http.HandleFunc("/", home) |