diff options
author | xengineering <me@xengineering.eu> | 2024-03-25 19:38:06 +0100 |
---|---|---|
committer | xengineering <me@xengineering.eu> | 2024-03-25 19:38:06 +0100 |
commit | 18b533f3b5dbb190d5d6f8769c5f7ef6052e0545 (patch) | |
tree | 5752b4d07b3888702a9def3d227b7502d1c3fb1a /main.go | |
parent | 99e0fdd5ad572a243b715260c313abdb33a991b8 (diff) | |
download | webiot-18b533f3b5dbb190d5d6f8769c5f7ef6052e0545.tar webiot-18b533f3b5dbb190d5d6f8769c5f7ef6052e0545.tar.zst webiot-18b533f3b5dbb190d5d6f8769c5f7ef6052e0545.zip |
Remove unused function mustRender()
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) { |