package i18n import ( "net/http" ) func HelloHandlerFunc(w http.ResponseWriter, r *http.Request) { p := Printer(r) p.Fprintf(w, "Hello, world") } // helloHandler implements http.Handler. type helloHandler struct {} func (h helloHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { p := Printer(r) p.Fprintf(w, "Hello, world") } func ExampleWithPrinter() { http.Handle("/h", WithPrinter(helloHandler{})) http.Handle("/hf", WithPrinter(http.HandlerFunc(HelloHandlerFunc))) }