summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2024-08-07 01:44:59 +0200
committerThomas Voss <mail@thomasvoss.com> 2024-08-07 01:44:59 +0200
commit634525b0cbc7e61cb4278a07c2269ecd2b336be2 (patch)
tree3124d2adb0890a91b57929913c32c1ca3a8c4b11
parent6867c84defa2b6bb3a7eb7e2cff2be402a8a9777 (diff)
Don’t create a new context
-rw-r--r--main.go3
1 files changed, 1 insertions, 2 deletions
diff --git a/main.go b/main.go
index ec164fb..b987ef2 100644
--- a/main.go
+++ b/main.go
@@ -41,7 +41,6 @@ func main() {
func finalHandler(w http.ResponseWriter, r *http.Request) {
p := r.Context().Value(middleware.PrinterKey).(i18n.Printer)
- ctx := context.WithValue(context.Background(), templates.PrinterKey, p)
path := r.URL.Path
if path != "/" && path[len(path)-1] == '/' {
@@ -53,7 +52,7 @@ func finalHandler(w http.ResponseWriter, r *http.Request) {
fmt.Fprintln(w, p.T("Page not found"))
} else {
w.WriteHeader(http.StatusOK)
- templates.Root(nil, c).Render(ctx, w)
+ templates.Root(nil, c).Render(r.Context(), w)
}
}