diff options
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 20 |
1 files changed, 0 insertions, 20 deletions
@@ -1,7 +1,6 @@ package main import ( - "bytes" "encoding/json" "embed" "flag" @@ -89,25 +88,6 @@ func index(devices DevicesConfig) func(http.ResponseWriter, *http.Request) { } } -// mustRender() renders a template file with the given data and panics if this -// is not possible. -func mustRender(filepath string, data interface{}) string { - file, err := os.ReadFile(filepath) - if err != nil { - log.Fatalf("Could not read '%s'!", filepath) - } - - tmpl, err := template.New(filepath).Parse(string(file)) - var buffer bytes.Buffer - err = tmpl.Execute(&buffer, data) - if err != nil { - fmt.Println(err) - log.Fatalf("Could not execute template for %s!", filepath) - } - - return buffer.String() -} - // api() returns the HTTP handler for the API endpoint. func api() func(http.ResponseWriter, *http.Request) { return func(w http.ResponseWriter, r *http.Request) { |