Skip to content

Commit 9e00c2d

Browse files
committed
Embed HTML
1 parent 2245c6f commit 9e00c2d

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<head>
44
<meta charset="UTF-8" />
55
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6-
<title>Bash Script Formatter & Linter</title>
6+
<title>Bash Script Tools</title>
77
<script src="https://cdn.tailwindcss.com"></script>
88
<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.32.2/ace.js"></script>
99
<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.32.2/mode-sh.min.js"></script>

main.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package main
22

33
import (
44
"bytes"
5+
_ "embed"
56
"encoding/json"
67
"fmt"
78
"html/template"
@@ -20,6 +21,9 @@ var (
2021
shellcheckPath = getEnvOrDefault("SHELLCHECK_PATH", "shellcheck")
2122
)
2223

24+
//go:embed index.html
25+
var indexHTML string
26+
2327
type ShellcheckResponse struct {
2428
HTML string `json:"html"`
2529
Annotations []Annotation `json:"annotations"`
@@ -59,7 +63,7 @@ func main() {
5963
}
6064

6165
func handleIndex(w http.ResponseWriter, r *http.Request) {
62-
tmpl := template.Must(template.ParseFiles("index.html"))
66+
tmpl := template.Must(template.New("index").Parse(indexHTML))
6367
tmpl.Execute(w, nil)
6468
}
6569

0 commit comments

Comments
 (0)