aboutsummaryrefslogtreecommitdiff
path: root/http_template.go
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2025-04-05 23:59:17 +0800
committerRunxi Yu <me@runxiyu.org>2025-04-05 23:59:17 +0800
commit0c0062b22ff4ddac9cf8c4ef84116eddba99bce2 (patch)
tree2d1790cdf42b0dcdb3f82f77cea2b86fb7a42120 /http_template.go
parentscfg: Remove tests for now (diff)
downloadforge-0c0062b22ff4ddac9cf8c4ef84116eddba99bce2.tar.gz
forge-0c0062b22ff4ddac9cf8c4ef84116eddba99bce2.tar.zst
forge-0c0062b22ff4ddac9cf8c4ef84116eddba99bce2.zip
templates shall no longer be a global variable
Diffstat (limited to 'http_template.go')
-rw-r--r--http_template.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/http_template.go b/http_template.go
index f60f026..d6af9fb 100644
--- a/http_template.go
+++ b/http_template.go
@@ -10,8 +10,8 @@ import (
// renderTemplate abstracts out the annoyances of reporting template rendering
// errors.
-func renderTemplate(w http.ResponseWriter, templateName string, params map[string]any) {
- if err := templates.ExecuteTemplate(w, templateName, params); err != nil {
+func (s *Server) renderTemplate(w http.ResponseWriter, templateName string, params map[string]any) {
+ if err := s.templates.ExecuteTemplate(w, templateName, params); err != nil {
http.Error(w, "error rendering template: "+err.Error(), http.StatusInternalServerError)
slog.Error("error rendering template", "error", err.Error())
}