From f9803a3bbfb3e730213825d6dc332b7c31321330 Mon Sep 17 00:00:00 2001 From: raylu Date: Mon, 1 Aug 2011 02:34:41 -0700 Subject: use new exp/template, make stuff work --- main.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'main.go') diff --git a/main.go b/main.go index bb8b272..de62f7a 100644 --- a/main.go +++ b/main.go @@ -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) -- cgit v1.2.3