Per GO_HTTP_SERVER_CONVENTIONS §12, templates should be embedded using //go:embed and parsed once via template.Must(template.ParseFS(...)). Currently, internal/handlers/handlers.go calls template.ParseFiles() on every request in renderTemplate(), which:
Reads from the filesystem at request time (not embedded)
Re-parses templates on every request (performance cost)
Does not work correctly in Docker containers if the templates directory is not in the expected location relative to the working directory
The static/ package already correctly uses //go:embed. Templates should follow the same pattern:
Per GO_HTTP_SERVER_CONVENTIONS §12, templates should be embedded using `//go:embed` and parsed once via `template.Must(template.ParseFS(...))`. Currently, `internal/handlers/handlers.go` calls `template.ParseFiles()` on every request in `renderTemplate()`, which:
1. Reads from the filesystem at request time (not embedded)
2. Re-parses templates on every request (performance cost)
3. Does not work correctly in Docker containers if the templates directory is not in the expected location relative to the working directory
The `static/` package already correctly uses `//go:embed`. Templates should follow the same pattern:
```go
// templates/templates.go
package templates
import (
"embed"
"text/template"
)
//go:embed *.html
var TemplatesRaw embed.FS
var TemplatesParsed *template.Template
func GetParsed() *template.Template {
if TemplatesParsed == nil {
TemplatesParsed = template.Must(template.ParseFS(TemplatesRaw, "*"))
}
return TemplatesParsed
}
```
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Per GO_HTTP_SERVER_CONVENTIONS §12, templates should be embedded using
//go:embedand parsed once viatemplate.Must(template.ParseFS(...)). Currently,internal/handlers/handlers.gocallstemplate.ParseFiles()on every request inrenderTemplate(), which:The
static/package already correctly uses//go:embed. Templates should follow the same pattern:clawbot referenced this issue2026-03-02 00:56:20 +01:00