aboutsummaryrefslogtreecommitdiff
path: root/resources.go
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2025-03-19 11:39:54 +0800
committerRunxi Yu <me@runxiyu.org>2025-03-19 12:03:39 +0800
commit90ce7b1faf976d76329a8c02008cd84c78a753f5 (patch)
tree9374618661e2521fec73ab9fc6f1f0f8f68f0c2b /resources.go
parentRemove underscores from Go code, pt 3 (diff)
downloadforge-90ce7b1faf976d76329a8c02008cd84c78a753f5.tar.gz
forge-90ce7b1faf976d76329a8c02008cd84c78a753f5.tar.zst
forge-90ce7b1faf976d76329a8c02008cd84c78a753f5.zip
Remove underscores from Go code, pt 4
Diffstat (limited to 'resources.go')
-rw-r--r--resources.go20
1 files changed, 10 insertions, 10 deletions
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)))
}