From 634525b0cbc7e61cb4278a07c2269ecd2b336be2 Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Wed, 7 Aug 2024 01:44:59 +0200 Subject: Don’t create a new context MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.go | 3 +-- 1 file changed, 1 insertion(+), 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) } } -- cgit v1.2.3