aboutsummaryrefslogtreecommitdiff
path: root/resources.go
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2025-02-18 10:23:44 +0800
committerRunxi Yu <me@runxiyu.org>2025-02-18 10:23:44 +0800
commitdd95e2dbfad7f39060dc70f145d0e1478770e454 (patch)
tree863f9c3a941f21a66fe0af1cbe9a09ae444c8a46 /resources.go
parentREADME.md: Mention that anonymous pushes to contrib/ are possible now (diff)
downloadforge-dd95e2dbfad7f39060dc70f145d0e1478770e454.tar.gz
forge-dd95e2dbfad7f39060dc70f145d0e1478770e454.tar.zst
forge-dd95e2dbfad7f39060dc70f145d0e1478770e454.zip
*.go: Add some comments for docs
Diffstat (limited to 'resources.go')
-rw-r--r--resources.go15
1 files changed, 5 insertions, 10 deletions
diff --git a/resources.go b/resources.go
index 4367f8e..2fe7883 100644
--- a/resources.go
+++ b/resources.go
@@ -7,6 +7,7 @@ import (
"net/http"
)
+// We embed all source for easy AGPL compliance.
//go:embed .gitignore .gitattributes
//go:embed LICENSE README.md
//go:embed *.go go.mod go.sum
@@ -17,21 +18,15 @@ import (
//go:embed git_hooks_client/*.c
//go:embed vendor/*
var source_fs embed.FS
-
-var source_handler http.Handler
-
-func init() {
- source_handler = http.StripPrefix(
- "/:/source/",
- http.FileServer(http.FS(source_fs)),
- )
-}
+var source_handler = http.StripPrefix(
+ "/:/source/",
+ http.FileServer(http.FS(source_fs)),
+)
//go:embed templates/* static/* git_hooks_client/git_hooks_client
var resources_fs embed.FS
var templates *template.Template
-
func load_templates() (err error) {
templates, err = template.New("templates").Funcs(template.FuncMap{
"first_line": first_line,