aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrégoire Duchêne <gduchene@awhk.org>2022-01-30 13:56:41 +0000
committerGrégoire Duchêne <gduchene@awhk.org>2022-01-30 13:56:41 +0000
commit3093c4cffa82211fd8ab3a141e54fcf9c10a8012 (patch)
treeb4c5fcbb342afca310a9fe5807ea9d6e99bb644b
parent359f6416cce4eb19389f414a58209cd20915656f (diff)
Move response template to resp.html
-rw-r--r--resp.go11
-rw-r--r--resp.html3
2 files changed, 10 insertions, 4 deletions
diff --git a/resp.go b/resp.go
index 408dcd3..2bbe434 100644
--- a/resp.go
+++ b/resp.go
@@ -4,6 +4,7 @@
package main
import (
+ _ "embed"
"log"
"net/http"
"path"
@@ -11,10 +12,12 @@ import (
"text/template"
)
-var body = template.Must(template.New("").Parse(`<!doctype html>
-<meta name="go-import" content="{{.Package}} {{.VCS}} {{.Repository}}">
-<title>go-import-redirect</title>
-`))
+var (
+ body = template.Must(template.New("").Parse(tmpl))
+
+ //go:embed resp.html
+ tmpl string
+)
type bodyData struct{ Package, Repository, VCS string }
diff --git a/resp.html b/resp.html
new file mode 100644
index 0000000..422024a
--- /dev/null
+++ b/resp.html
@@ -0,0 +1,3 @@
+<!doctype html>
+<meta name="go-import" content="{{.Package}} {{.VCS}} {{.Repository}}">
+<title>go-import-redirect</title>