diff options
| author | Thomas Voss <mail@thomasvoss.com> | 2024-08-07 01:44:59 +0200 | 
|---|---|---|
| committer | Thomas Voss <mail@thomasvoss.com> | 2024-08-07 01:44:59 +0200 | 
| commit | 634525b0cbc7e61cb4278a07c2269ecd2b336be2 (patch) | |
| tree | 3124d2adb0890a91b57929913c32c1ca3a8c4b11 | |
| parent | 6867c84defa2b6bb3a7eb7e2cff2be402a8a9777 (diff) | |
Don’t create a new context
| -rw-r--r-- | main.go | 3 | 
1 files changed, 1 insertions, 2 deletions
@@ -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)  	}  }  |