From 18b533f3b5dbb190d5d6f8769c5f7ef6052e0545 Mon Sep 17 00:00:00 2001 From: xengineering Date: Mon, 25 Mar 2024 19:38:06 +0100 Subject: Remove unused function mustRender() --- main.go | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/main.go b/main.go index 4ac41e8..4331123 100644 --- a/main.go +++ b/main.go @@ -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) { -- cgit v1.2.3-70-g09d2