From cd2e12800112431e45385ab2453fd59a556c253c Mon Sep 17 00:00:00 2001 From: Jasper Bok Date: Sun, 13 Aug 2023 16:44:41 +0200 Subject: [PATCH] Embed the index template --- server.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/server.go b/server.go index 42a1b22..74fa2fa 100644 --- a/server.go +++ b/server.go @@ -1,12 +1,16 @@ package main import ( + "embed" "html/template" "log" "net/http" "time" ) +//go:embed index.html +var indexTemplate string + type TemplateQuay struct { Name string Town string @@ -48,7 +52,7 @@ func handleIndex(w http.ResponseWriter, r *http.Request) { } tpl := template.New("index.html").Funcs(tplFunctions) - tpl, _ = tpl.ParseFiles("index.html") + tpl, _ = tpl.Parse(indexTemplate) _ = tpl.Execute(w, ctxt) }