From 90ce7b1faf976d76329a8c02008cd84c78a753f5 Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Wed, 19 Mar 2025 11:39:54 +0800 Subject: Remove underscores from Go code, pt 4 --- resources.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'resources.go') diff --git a/resources.go b/resources.go index bbb03c0..c1b4a9b 100644 --- a/resources.go +++ b/resources.go @@ -23,11 +23,11 @@ import ( //go:embed static/* templates/* scripts/* sql/* //go:embed hookc/*.c //go:embed vendor/* -var source_fs embed.FS +var sourceFS embed.FS -var source_handler = http.StripPrefix( +var sourceHandler = http.StripPrefix( "/:/source/", - http.FileServer(http.FS(source_fs)), + http.FileServer(http.FS(sourceFS)), ) //go:embed templates/* static/* hookc/hookc @@ -40,10 +40,10 @@ func loadTemplates() (err error) { m.Add("text/html", &html.Minifier{TemplateDelims: [2]string{"{{", "}}"}, KeepDefaultAttrVals: true}) templates = template.New("templates").Funcs(template.FuncMap{ - "first_line": first_line, - "base_name": base_name, - "path_escape": path_escape, - "query_escape": query_escape, + "first_line": firstLine, + "base_name": baseName, + "path_escape": pathEscape, + "query_escape": queryEscape, }) err = fs.WalkDir(resourcesFS, "templates", func(path string, d fs.DirEntry, err error) error { @@ -71,12 +71,12 @@ func loadTemplates() (err error) { return err } -var static_handler http.Handler +var staticHandler http.Handler func init() { - static_fs, err := fs.Sub(resourcesFS, "static") + staticFS, err := fs.Sub(resourcesFS, "static") if err != nil { panic(err) } - static_handler = http.StripPrefix("/:/static/", http.FileServer(http.FS(static_fs))) + staticHandler = http.StripPrefix("/:/static/", http.FileServer(http.FS(staticFS))) } -- cgit v1.2.3