summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main.go14
1 files changed, 6 insertions, 8 deletions
diff --git a/main.go b/main.go
index 15fcc7a..1362cf1 100644
--- a/main.go
+++ b/main.go
@@ -23,7 +23,7 @@ func main() {
log.Fatal(err)
}
- http.HandleFunc("/", index(config.Devices))
+ http.HandleFunc("/", index)
http.HandleFunc("/api", api)
http.Handle("/static/", http.StripPrefix("/static/",
http.FileServer(http.FS(static))))
@@ -46,13 +46,11 @@ func parseFlags() string {
}
// index() returns a HTTP handler for the index page.
-func index(devices DevicesConfig) func(http.ResponseWriter, *http.Request) {
- return func(w http.ResponseWriter, r *http.Request) {
- err := templates.Execute(w, devices)
- if err != nil {
- http.Error(w, fmt.Sprint(err), http.StatusInternalServerError)
- return
- }
+func index(w http.ResponseWriter, r *http.Request) {
+ err := templates.Execute(w, config.Devices)
+ if err != nil {
+ http.Error(w, fmt.Sprint(err), http.StatusInternalServerError)
+ return
}
}