diff options
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -11,6 +11,7 @@ import ( //go:embed simple.css/simple.css templates/index.html var static embed.FS +var templates *template.Template func main() { configPath := parseFlags() @@ -37,13 +38,13 @@ func parseFlags() string { // index() returns a HTTP handler for the index page. func index(devices DevicesConfig) func(http.ResponseWriter, *http.Request) { - tmpl, err := template.ParseFS(static, "templates/index.html") + templates, err := template.ParseFS(static, "templates/index.html") if err != nil { log.Fatal(err) } return func(w http.ResponseWriter, r *http.Request) { - err = tmpl.Execute(w, devices) + err = templates.Execute(w, devices) if err != nil { http.Error(w, fmt.Sprint(err), http.StatusInternalServerError) return |