@@ -20,7 +20,7 @@ func Example_httprouterMiddlewareByHandler() {
2020 myHandler := func (w http.ResponseWriter , r * http.Request , p httprouter.Params ) {
2121 id := p .ByName ("id" )
2222 w .WriteHeader (http .StatusOK )
23- w .Write ([]byte ("hello world! " + id ))
23+ _ , _ = w .Write ([]byte ("hello world! " + id ))
2424 }
2525
2626 // Create our router.
@@ -36,7 +36,9 @@ func Example_httprouterMiddlewareByHandler() {
3636
3737 // Serve metrics from the default prometheus registry.
3838 log .Printf ("serving metrics at: %s" , ":8081" )
39- go http .ListenAndServe (":8081" , promhttp .Handler ())
39+ go func () {
40+ _ = http .ListenAndServe (":8081" , promhttp .Handler ())
41+ }()
4042
4143 // Serve our handler.
4244 log .Printf ("listening at: %s" , ":8080" )
@@ -52,7 +54,7 @@ func Example_httprouterMiddlewareOnRouter() {
5254 myHandler := func (w http.ResponseWriter , r * http.Request , p httprouter.Params ) {
5355 id := p .ByName ("id" )
5456 w .WriteHeader (http .StatusOK )
55- w .Write ([]byte ("hello world! " + id ))
57+ _ , _ = w .Write ([]byte ("hello world! " + id ))
5658 }
5759
5860 // Create our router and add the middleware.
@@ -68,7 +70,9 @@ func Example_httprouterMiddlewareOnRouter() {
6870
6971 // Serve metrics from the default prometheus registry.
7072 log .Printf ("serving metrics at: %s" , ":8081" )
71- go http .ListenAndServe (":8081" , promhttp .Handler ())
73+ go func () {
74+ _ = http .ListenAndServe (":8081" , promhttp .Handler ())
75+ }()
7276
7377 // Wrap the router with the middleware.
7478 h := mdlw .Handler ("" , r )
0 commit comments