From 4ddc5c59f59373c10e86508a5fc4d3443d5e2c58 Mon Sep 17 00:00:00 2001 From: Eliot Whalan Date: Thu, 23 Jun 2016 19:00:17 +1000 Subject: [PATCH] Template bug fix --- main.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/main.go b/main.go index 4f554b6..d50507b 100644 --- a/main.go +++ b/main.go @@ -218,8 +218,6 @@ func getPaste(paste string) string { } -var templates = template.Must(template.ParseFiles("assets/paste.html")) - func pasteHandler(w http.ResponseWriter, r *http.Request) { vars := mux.Vars(r) paste := vars["pasteId"] @@ -228,10 +226,11 @@ func pasteHandler(w http.ResponseWriter, r *http.Request) { Title: paste, Body: []byte(s), } - err := templates.ExecuteTemplate(w, "assets/paste.html", p) + t, err := template.ParseFiles("assets/edit.html") if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) } + t.Execute(w, p) } func rawHandler(w http.ResponseWriter, r *http.Request) {