I get some memory error when trying to execute this code:
package web
import (
"net/http"
"html/template"
)
type Hello struct {
Level string
}
func Main(w http.ResponseWriter, r *http.Request) {
h := Hello{Level: "gsdfg"}
t, _ := template.ParseFiles("web.html")
t.Execute(w, h)
}
The error message I get in the browser is this:
the runtime process gave a bad HTTP response: ''
2015/03/26 11:34:56 http: panic serving 127.0.0.1:43269: runtime error: invalid memory address or nil pointer dereference
I dont understand what I am doing wrong...