@@ -17,7 +17,6 @@ import (
17
17
// - Keep the benchmark functions etc. alphabetically sorted
18
18
// - Make a pull request (without benchmark results) at
19
19
// https://github.com/julienschmidt/go-http-routing-benchmark
20
- "github.com/Unknwon/macaron"
21
20
"github.com/ant0ine/go-json-rest/rest"
22
21
"github.com/astaxie/beego"
23
22
"github.com/astaxie/beego/context"
@@ -27,6 +26,7 @@ import (
27
26
"github.com/dimfeld/httptreemux"
28
27
"github.com/emicklei/go-restful"
29
28
"github.com/gin-gonic/gin"
29
+ "github.com/go-macaron/macaron"
30
30
"github.com/go-martini/martini"
31
31
"github.com/go-zoo/bone"
32
32
"github.com/gocraft/web"
@@ -53,7 +53,6 @@ import (
53
53
goji "github.com/zenazn/goji/web"
54
54
gojiv2 "goji.io"
55
55
gojiv2pat "goji.io/pat"
56
- gcontext "golang.org/x/net/context"
57
56
)
58
57
59
58
type route struct {
@@ -330,59 +329,59 @@ func loadDencoSingle(method, path string, h denco.HandlerFunc) http.Handler {
330
329
}
331
330
332
331
// Echo
333
- func echoHandler (c * echo.Context ) error {
332
+ func echoHandler (c echo.Context ) error {
334
333
return nil
335
334
}
336
335
337
- func echoHandlerWrite (c * echo.Context ) error {
336
+ func echoHandlerWrite (c echo.Context ) error {
338
337
io .WriteString (c .Response (), c .Param ("name" ))
339
338
return nil
340
339
}
341
340
342
- func echoHandlerTest (c * echo.Context ) error {
341
+ func echoHandlerTest (c echo.Context ) error {
343
342
io .WriteString (c .Response (), c .Request ().RequestURI )
344
343
return nil
345
344
}
346
345
347
346
func loadEcho (routes []route ) http.Handler {
348
- var h interface {} = echoHandler
349
- if loadTestHandler {
347
+ var h echo. HandlerFunc = echoHandler
348
+ if loadTestHandler {
350
349
h = echoHandlerTest
351
350
}
352
351
353
352
e := echo .New ()
354
353
for _ , r := range routes {
355
354
switch r .method {
356
355
case "GET" :
357
- e .Get (r .path , h )
356
+ e .GET (r .path , h )
358
357
case "POST" :
359
- e .Post (r .path , h )
358
+ e .POST (r .path , h )
360
359
case "PUT" :
361
- e .Put (r .path , h )
360
+ e .PUT (r .path , h )
362
361
case "PATCH" :
363
- e .Patch (r .path , h )
362
+ e .PATCH (r .path , h )
364
363
case "DELETE" :
365
- e .Delete (r .path , h )
364
+ e .DELETE (r .path , h )
366
365
default :
367
366
panic ("Unknow HTTP method: " + r .method )
368
367
}
369
368
}
370
369
return e
371
370
}
372
371
373
- func loadEchoSingle (method , path string , h interface {} ) http.Handler {
372
+ func loadEchoSingle (method , path string , h echo. HandlerFunc ) http.Handler {
374
373
e := echo .New ()
375
374
switch method {
376
375
case "GET" :
377
- e .Get (path , h )
376
+ e .GET (path , h )
378
377
case "POST" :
379
- e .Post (path , h )
378
+ e .POST (path , h )
380
379
case "PUT" :
381
- e .Put (path , h )
380
+ e .PUT (path , h )
382
381
case "PATCH" :
383
- e .Patch (path , h )
382
+ e .PATCH (path , h )
384
383
case "DELETE" :
385
- e .Delete (path , h )
384
+ e .DELETE (path , h )
386
385
default :
387
386
panic ("Unknow HTTP method: " + method )
388
387
}
@@ -532,13 +531,13 @@ func loadGojiSingle(method, path string, handler interface{}) http.Handler {
532
531
}
533
532
534
533
// goji v2 (github.com/goji/goji)
535
- func gojiv2Handler (ctx gcontext. Context , w http.ResponseWriter , r * http.Request ) {}
534
+ func gojiv2Handler (w http.ResponseWriter , r * http.Request ) {}
536
535
537
- func gojiv2HandlerWrite (ctx gcontext. Context , w http.ResponseWriter , r * http.Request ) {
538
- io .WriteString (w , gojiv2pat .Param (ctx , "name" ))
536
+ func gojiv2HandlerWrite (w http.ResponseWriter , r * http.Request ) {
537
+ io .WriteString (w , gojiv2pat .Param (r , "name" ))
539
538
}
540
539
541
- func gojiv2HandlerTest (ctx gcontext. Context , w http.ResponseWriter , r * http.Request ) {
540
+ func gojiv2HandlerTest (w http.ResponseWriter , r * http.Request ) {
542
541
io .WriteString (w , r .RequestURI )
543
542
}
544
543
@@ -552,35 +551,35 @@ func loadGojiv2(routes []route) http.Handler {
552
551
for _ , route := range routes {
553
552
switch route .method {
554
553
case "GET" :
555
- mux .HandleFuncC (gojiv2pat .Get (route .path ), h )
554
+ mux .HandleFunc (gojiv2pat .Get (route .path ), h )
556
555
case "POST" :
557
- mux .HandleFuncC (gojiv2pat .Post (route .path ), h )
556
+ mux .HandleFunc (gojiv2pat .Post (route .path ), h )
558
557
case "PUT" :
559
- mux .HandleFuncC (gojiv2pat .Put (route .path ), h )
558
+ mux .HandleFunc (gojiv2pat .Put (route .path ), h )
560
559
case "PATCH" :
561
- mux .HandleFuncC (gojiv2pat .Patch (route .path ), h )
560
+ mux .HandleFunc (gojiv2pat .Patch (route .path ), h )
562
561
case "DELETE" :
563
- mux .HandleFuncC (gojiv2pat .Delete (route .path ), h )
562
+ mux .HandleFunc (gojiv2pat .Delete (route .path ), h )
564
563
default :
565
564
panic ("Unknown HTTP method: " + route .method )
566
565
}
567
566
}
568
567
return mux
569
568
}
570
569
571
- func loadGojiv2Single (method , path string , handler gojiv2. HandlerFunc ) http.Handler {
570
+ func loadGojiv2Single (method , path string , handler func (http. ResponseWriter , * http. Request ) ) http.Handler {
572
571
mux := gojiv2 .NewMux ()
573
572
switch method {
574
573
case "GET" :
575
- mux .HandleFuncC (gojiv2pat .Get (path ), handler )
574
+ mux .HandleFunc (gojiv2pat .Get (path ), handler )
576
575
case "POST" :
577
- mux .HandleFuncC (gojiv2pat .Post (path ), handler )
576
+ mux .HandleFunc (gojiv2pat .Post (path ), handler )
578
577
case "PUT" :
579
- mux .HandleFuncC (gojiv2pat .Put (path ), handler )
578
+ mux .HandleFunc (gojiv2pat .Put (path ), handler )
580
579
case "PATCH" :
581
- mux .HandleFuncC (gojiv2pat .Patch (path ), handler )
580
+ mux .HandleFunc (gojiv2pat .Patch (path ), handler )
582
581
case "DELETE" :
583
- mux .HandleFuncC (gojiv2pat .Delete (path ), handler )
582
+ mux .HandleFunc (gojiv2pat .Delete (path ), handler )
584
583
default :
585
584
panic ("Unknow HTTP method: " + method )
586
585
}
@@ -1255,11 +1254,11 @@ func loadRevelSingle(method, path, action string) http.Handler {
1255
1254
// Rivet
1256
1255
func rivetHandler () {}
1257
1256
1258
- func rivetHandlerWrite (c rivet.Context ) {
1257
+ func rivetHandlerWrite (c * rivet.Context ) {
1259
1258
c .WriteString (c .Get ("name" ))
1260
1259
}
1261
1260
1262
- func rivetHandlerTest (c rivet.Context ) {
1261
+ func rivetHandlerTest (c * rivet.Context ) {
1263
1262
c .WriteString (c .Req .RequestURI )
1264
1263
}
1265
1264
0 commit comments