diff --git a/bizdemo/tiktok_demo/main.go b/bizdemo/tiktok_demo/main.go index 54e50c55..d33725dd 100644 --- a/bizdemo/tiktok_demo/main.go +++ b/bizdemo/tiktok_demo/main.go @@ -32,7 +32,7 @@ import ( ) // Set up /src/*name route forwarding to access minio from external network -func minioReverseProxy(c context.Context, ctx *app.RequestContext) { +func minioReverseProxy(ctx context.Context, c *app.RequestContext) { proxy, _ := reverseproxy.NewSingleHostReverseProxy("http://localhost:18001") ctx.URI().SetPath(ctx.Param("name")) hlog.CtxInfof(c, string(ctx.Request.URI().Path())) diff --git a/file/html-fs/main.go b/file/html-fs/main.go index 042c61d7..9c7d767c 100644 --- a/file/html-fs/main.go +++ b/file/html-fs/main.go @@ -33,7 +33,7 @@ func main() { fs := &app.FS{Root: root, PathRewrite: getPathRewriter(prefix)} h.StaticFS(prefix, fs) - h.GET("/", func(c context.Context, ctx *app.RequestContext) { + h.GET("/", func(ctx context.Context, c *app.RequestContext) { ctx.HTML(200, "index.html", nil) }) h.Spin() diff --git a/file/html/main.go b/file/html/main.go index bfde00e6..e488b590 100644 --- a/file/html/main.go +++ b/file/html/main.go @@ -29,7 +29,7 @@ func main() { h.Static("/", "./assets") - h.GET("/", func(c context.Context, ctx *app.RequestContext) { + h.GET("/", func(ctx context.Context, c *app.RequestContext) { ctx.HTML(200, "index.html", nil) }) h.Spin() diff --git a/hex/hex_trans_handler.go b/hex/hex_trans_handler.go index 43ba0604..56f831b4 100644 --- a/hex/hex_trans_handler.go +++ b/hex/hex_trans_handler.go @@ -90,7 +90,7 @@ func initHertz() *route.Engine { h := hertzServer.New() // add a ping route to test - h.GET("/ping", func(c context.Context, ctx *app.RequestContext) { + h.GET("/ping", func(ctx context.Context, c *app.RequestContext) { ctx.JSON(consts.StatusOK, utils.H{"ping": "pong"}) }) diff --git a/hz/template/main.go b/hz/template/main.go index 7a48a4a9..b9efc8f8 100755 --- a/hz/template/main.go +++ b/hz/template/main.go @@ -28,7 +28,7 @@ func main() { h := server.New(server.WithHostPorts(address)) // add a ping route to test - h.GET("/ping", func(c context.Context, ctx *app.RequestContext) { + h.GET("/ping", func(ctx context.Context, c *app.RequestContext) { ctx.JSON(consts.StatusOK, utils.H{"ping": "pong"}) }) diff --git a/hz/template/template/layout.yaml b/hz/template/template/layout.yaml index 1d8054d7..7cdaea98 100644 --- a/hz/template/template/layout.yaml +++ b/hz/template/template/layout.yaml @@ -34,7 +34,7 @@ layouts: h := server.New(server.WithHostPorts(address)) // add a ping route to test - h.GET("/ping", func(c context.Context, ctx *app.RequestContext) { + h.GET("/ping", func(ctx context.Context, c *app.RequestContext) { ctx.JSON(consts.StatusOK, utils.H{"ping": "pong"}) }) @@ -561,4 +561,4 @@ layouts: CURDIR=$(cd $(dirname $0); pwd) BinaryName={{.ServiceName}} echo "$CURDIR/bin/${BinaryName}" - exec $CURDIR/bin/${BinaryName} \ No newline at end of file + exec $CURDIR/bin/${BinaryName} diff --git a/hz_kitex_demo/hertz-server/main.go b/hz_kitex_demo/hertz-server/main.go index f60bb230..6238db2d 100755 --- a/hz_kitex_demo/hertz-server/main.go +++ b/hz_kitex_demo/hertz-server/main.go @@ -25,7 +25,7 @@ func main() { // We can define some global middleware here, such as link tracing, telemetry, cross-domain requests, etc. // Currently, hertz provides a series of middleware extensions that you can refer to if you need them: https://github.com/hertz-contrib - h.Use(func(c context.Context, ctx *app.RequestContext) { + h.Use(func(ctx context.Context, c *app.RequestContext) { fmt.Println("pre-handler") ctx.Next(c) fmt.Println("post-handler") diff --git a/middleware/csrf/custom_errorfunc/main.go b/middleware/csrf/custom_errorfunc/main.go index 1be6481c..a443863a 100644 --- a/middleware/csrf/custom_errorfunc/main.go +++ b/middleware/csrf/custom_errorfunc/main.go @@ -60,10 +60,10 @@ func main() { h.Use(sessions.New("csrf-session", store)) h.Use(csrf.New(csrf.WithErrorFunc(myErrFunc))) - h.GET("/protected", func(c context.Context, ctx *app.RequestContext) { + h.GET("/protected", func(ctx context.Context, c *app.RequestContext) { ctx.String(200, csrf.GetToken(ctx)) }) - h.POST("/protected", func(c context.Context, ctx *app.RequestContext) { + h.POST("/protected", func(ctx context.Context, c *app.RequestContext) { ctx.String(200, "CSRF token is valid") }) diff --git a/middleware/csrf/custom_extractor/main.go b/middleware/csrf/custom_extractor/main.go index fd658882..32b46003 100644 --- a/middleware/csrf/custom_extractor/main.go +++ b/middleware/csrf/custom_extractor/main.go @@ -42,10 +42,10 @@ func main() { h.Use(sessions.New("csrf-session", store)) h.Use(csrf.New(csrf.WithExtractor(myExtractor))) - h.GET("/protected", func(c context.Context, ctx *app.RequestContext) { + h.GET("/protected", func(ctx context.Context, c *app.RequestContext) { ctx.String(200, csrf.GetToken(ctx)) }) - h.POST("/protected", func(c context.Context, ctx *app.RequestContext) { + h.POST("/protected", func(ctx context.Context, c *app.RequestContext) { ctx.String(200, "CSRF token is valid") }) diff --git a/middleware/csrf/custom_ignoremethods/main.go b/middleware/csrf/custom_ignoremethods/main.go index 330635fe..1877b9e8 100644 --- a/middleware/csrf/custom_ignoremethods/main.go +++ b/middleware/csrf/custom_ignoremethods/main.go @@ -33,11 +33,11 @@ func main() { h.Use(sessions.New("csrf-session", store)) h.Use(csrf.New(csrf.WithIgnoredMethods([]string{"GET", "HEAD", "TRACE"}))) - h.GET("/protected", func(c context.Context, ctx *app.RequestContext) { + h.GET("/protected", func(ctx context.Context, c *app.RequestContext) { ctx.String(200, csrf.GetToken(ctx)) }) - h.OPTIONS("/protected", func(c context.Context, ctx *app.RequestContext) { + h.OPTIONS("/protected", func(ctx context.Context, c *app.RequestContext) { ctx.String(200, "success") }) h.Spin() diff --git a/middleware/csrf/custom_keylookup/main.go b/middleware/csrf/custom_keylookup/main.go index 3d5368cd..f0242dd2 100644 --- a/middleware/csrf/custom_keylookup/main.go +++ b/middleware/csrf/custom_keylookup/main.go @@ -32,10 +32,10 @@ func main() { h.Use(sessions.New("csrf-session", store)) h.Use(csrf.New(csrf.WithKeyLookUp("form:csrf"))) - h.GET("/protected", func(c context.Context, ctx *app.RequestContext) { + h.GET("/protected", func(ctx context.Context, c *app.RequestContext) { ctx.String(200, csrf.GetToken(ctx)) }) - h.POST("/protected", func(c context.Context, ctx *app.RequestContext) { + h.POST("/protected", func(ctx context.Context, c *app.RequestContext) { ctx.String(200, "CSRF token is valid") }) diff --git a/middleware/csrf/custom_next/main.go b/middleware/csrf/custom_next/main.go index 2da6f264..871975e1 100644 --- a/middleware/csrf/custom_next/main.go +++ b/middleware/csrf/custom_next/main.go @@ -42,7 +42,7 @@ func main() { // skip csrf middleware when request method is post h.Use(csrf.New(csrf.WithNext(isPostMethod))) - h.POST("/protected", func(c context.Context, ctx *app.RequestContext) { + h.POST("/protected", func(ctx context.Context, c *app.RequestContext) { ctx.String(200, "success even no csrf-token in header") }) h.Spin() diff --git a/middleware/csrf/custom_secret/main.go b/middleware/csrf/custom_secret/main.go index 54ecb84f..c75ae0b0 100644 --- a/middleware/csrf/custom_secret/main.go +++ b/middleware/csrf/custom_secret/main.go @@ -33,10 +33,10 @@ func main() { h.Use(sessions.New("csrf-session", store)) h.Use(csrf.New(csrf.WithSecret("your_secret"))) - h.GET("/protected", func(c context.Context, ctx *app.RequestContext) { + h.GET("/protected", func(ctx context.Context, c *app.RequestContext) { ctx.String(200, csrf.GetToken(ctx)) }) - h.POST("/protected", func(c context.Context, ctx *app.RequestContext) { + h.POST("/protected", func(ctx context.Context, c *app.RequestContext) { ctx.String(200, "CSRF token is valid") }) diff --git a/middleware/csrf/default/main.go b/middleware/csrf/default/main.go index 3387260e..f2c8d5a2 100644 --- a/middleware/csrf/default/main.go +++ b/middleware/csrf/default/main.go @@ -33,11 +33,11 @@ func main() { h.Use(sessions.New("csrf-session", store)) h.Use(csrf.New()) - h.GET("/protected", func(c context.Context, ctx *app.RequestContext) { + h.GET("/protected", func(ctx context.Context, c *app.RequestContext) { ctx.String(200, csrf.GetToken(ctx)) }) - h.POST("/protected", func(c context.Context, ctx *app.RequestContext) { + h.POST("/protected", func(ctx context.Context, c *app.RequestContext) { ctx.String(200, "CSRF token is valid") }) diff --git a/middleware/loadbalance/round_robin/server/main.go b/middleware/loadbalance/round_robin/server/main.go index 7998eb1e..bd769478 100644 --- a/middleware/loadbalance/round_robin/server/main.go +++ b/middleware/loadbalance/round_robin/server/main.go @@ -50,7 +50,7 @@ func main() { Tags: nil, }), ) - h.GET("/ping", func(c context.Context, ctx *app.RequestContext) { + h.GET("/ping", func(ctx context.Context, c *app.RequestContext) { ctx.JSON(consts.StatusOK, utils.H{"addr": addr}) }) h.Spin() diff --git a/middleware/pprof/custom_prefix/server.go b/middleware/pprof/custom_prefix/server.go index 75f0b3eb..a1d9f606 100644 --- a/middleware/pprof/custom_prefix/server.go +++ b/middleware/pprof/custom_prefix/server.go @@ -32,7 +32,7 @@ func main() { // default is "debug/pprof" pprof.Register(h, "dev/pprof") - h.GET("/ping", func(c context.Context, ctx *app.RequestContext) { + h.GET("/ping", func(ctx context.Context, c *app.RequestContext) { ctx.JSON(consts.StatusOK, utils.H{"ping": "pong"}) }) diff --git a/middleware/pprof/custom_router_group/server.go b/middleware/pprof/custom_router_group/server.go index 794ed6eb..89ec1062 100644 --- a/middleware/pprof/custom_router_group/server.go +++ b/middleware/pprof/custom_router_group/server.go @@ -33,7 +33,7 @@ func main() { adminGroup := h.Group("/admin") - adminGroup.GET("/ping", func(c context.Context, ctx *app.RequestContext) { + adminGroup.GET("/ping", func(ctx context.Context, c *app.RequestContext) { ctx.JSON(consts.StatusOK, utils.H{"ping": "pong"}) }) diff --git a/middleware/pprof/default/server.go b/middleware/pprof/default/server.go index ab25b965..4081137f 100644 --- a/middleware/pprof/default/server.go +++ b/middleware/pprof/default/server.go @@ -31,7 +31,7 @@ func main() { pprof.Register(h) - h.GET("/ping", func(c context.Context, ctx *app.RequestContext) { + h.GET("/ping", func(ctx context.Context, c *app.RequestContext) { ctx.JSON(consts.StatusOK, utils.H{"ping": "pong"}) }) diff --git a/monitoring/README.md b/monitoring/README.md index 1dc27331..2d8a3c2c 100644 --- a/monitoring/README.md +++ b/monitoring/README.md @@ -18,11 +18,11 @@ func main() { ... h := server.Default(server.WithHostPorts("127.0.0.1:8080"), server.WithTracer(prometheus.NewServerTracer(":9091", "/hertz"))) - h.GET("/metricGet", func(c context.Context, ctx *app.RequestContext) { + h.GET("/metricGet", func(ctx context.Context, c *app.RequestContext) { ctx.String(200, "hello get") }) - h.POST("/metricPost", func(c context.Context, ctx *app.RequestContext) { + h.POST("/metricPost", func(ctx context.Context, c *app.RequestContext) { time.Sleep(100 * time.Millisecond) ctx.String(200, "hello post") }) @@ -55,4 +55,4 @@ func main() { `histogram_quantile(0.9,sum(rate(hertz_server_latency_us_bucket{statusCode="200"}[1m]))by(le))` -For more information about hertz monitoring, please click [monitoring](https://www.cloudwego.io/zh/docs/hertz/tutorials/framework-exten/monitor/) \ No newline at end of file +For more information about hertz monitoring, please click [monitoring](https://www.cloudwego.io/zh/docs/hertz/tutorials/framework-exten/monitor/) diff --git a/monitoring/main.go b/monitoring/main.go index 938dbedf..139986ca 100644 --- a/monitoring/main.go +++ b/monitoring/main.go @@ -35,11 +35,11 @@ func main() { ), ) - h.GET("/metricGet", func(c context.Context, ctx *app.RequestContext) { + h.GET("/metricGet", func(ctx context.Context, c *app.RequestContext) { ctx.String(200, "hello get") }) - h.POST("/metricPost", func(c context.Context, ctx *app.RequestContext) { + h.POST("/metricPost", func(ctx context.Context, c *app.RequestContext) { time.Sleep(100 * time.Millisecond) ctx.String(200, "hello post") }) diff --git a/multiple_service/main.go b/multiple_service/main.go index 13e572cb..b66350ae 100644 --- a/multiple_service/main.go +++ b/multiple_service/main.go @@ -30,7 +30,7 @@ var wg sync.WaitGroup func hertz1() { h := server.Default(server.WithHostPorts(":8080")) - h.GET("/ping", func(c context.Context, ctx *app.RequestContext) { + h.GET("/ping", func(ctx context.Context, c *app.RequestContext) { ctx.JSON(consts.StatusOK, utils.H{"ping": "pong1"}) }) h.Spin() @@ -38,7 +38,7 @@ func hertz1() { func hertz2() { h := server.Default(server.WithHostPorts(":8081")) - h.GET("/ping", func(c context.Context, ctx *app.RequestContext) { + h.GET("/ping", func(ctx context.Context, c *app.RequestContext) { ctx.JSON(consts.StatusOK, utils.H{"ping": "pong2"}) }) h.Spin() diff --git a/opentelemetry/README.md b/opentelemetry/README.md index 7f2bc496..49496fd0 100644 --- a/opentelemetry/README.md +++ b/opentelemetry/README.md @@ -108,7 +108,7 @@ func init() { #### log with context ```go -h.GET("/ping", func(c context.Context, ctx *app.RequestContext) { +h.GET("/ping", func(ctx context.Context, c *app.RequestContext) { req := &api.Request{Message: "my request"} resp, err := client.Echo(c, req) if err != nil { diff --git a/opentelemetry/hertz/server/main.go b/opentelemetry/hertz/server/main.go index 7afd781e..f05264e5 100644 --- a/opentelemetry/hertz/server/main.go +++ b/opentelemetry/hertz/server/main.go @@ -65,7 +65,7 @@ func main() { hlog.Fatal(err) } - h.GET("/ping", func(c context.Context, ctx *app.RequestContext) { + h.GET("/ping", func(ctx context.Context, c *app.RequestContext) { req := &api.Request{Message: "my request"} resp, err := client.Echo(c, req) if err != nil { diff --git a/protocol/http1/main.go b/protocol/http1/main.go index 0325c395..ff3dc58a 100644 --- a/protocol/http1/main.go +++ b/protocol/http1/main.go @@ -28,7 +28,7 @@ import ( func main() { h := server.Default(server.WithHostPorts("127.0.0.1:8080")) - h.GET("/ping", func(c context.Context, ctx *app.RequestContext) { + h.GET("/ping", func(ctx context.Context, c *app.RequestContext) { ctx.JSON(consts.StatusOK, utils.H{"ping": "pong"}) }) diff --git a/protocol/tls/main.go b/protocol/tls/main.go index 856dee1d..37dd98ae 100644 --- a/protocol/tls/main.go +++ b/protocol/tls/main.go @@ -50,13 +50,13 @@ func main() { h := server.Default(server.WithTLS(cfg), server.WithHostPorts(":8443")) - h.Use(func(c context.Context, ctx *app.RequestContext) { + h.Use(func(ctx context.Context, c *app.RequestContext) { fmt.Fprint(ctx, "Before real handle...\n") ctx.Next(c) fmt.Fprint(ctx, "After real handle...\n") }) - h.GET("/ping", func(c context.Context, ctx *app.RequestContext) { + h.GET("/ping", func(ctx context.Context, c *app.RequestContext) { ctx.String(consts.StatusOK, "TLS test\n") }) diff --git a/render/html/main.go b/render/html/main.go index ee2658e5..c7d1c97d 100644 --- a/render/html/main.go +++ b/render/html/main.go @@ -42,13 +42,13 @@ func main() { }) h.LoadHTMLGlob("render/html/*") - h.GET("/index", func(c context.Context, ctx *app.RequestContext) { + h.GET("/index", func(ctx context.Context, c *app.RequestContext) { ctx.HTML(http.StatusOK, "index.tmpl", utils.H{ "title": "Main website", }) }) - h.GET("/raw", func(c context.Context, ctx *app.RequestContext) { + h.GET("/raw", func(ctx context.Context, c *app.RequestContext) { ctx.HTML(http.StatusOK, "template1.html", map[string]interface{}{ "now": time.Date(2017, 0o7, 0o1, 0, 0, 0, 0, time.UTC), }) diff --git a/reverseproxy/customize_error/main.go b/reverseproxy/customize_error/main.go index b4ff16b2..0213ed21 100644 --- a/reverseproxy/customize_error/main.go +++ b/reverseproxy/customize_error/main.go @@ -36,7 +36,7 @@ func main() { c.String(404, "fake 404 not found") }) - h.GET("/proxy/backend", func(cc context.Context, c *app.RequestContext) { + h.GET("/proxy/backend", func(ctx context.Context, c *app.RequestContext) { c.JSON(200, utils.H{ "msg": "proxy success!!", }) diff --git a/reverseproxy/discovery/registry/main.go b/reverseproxy/discovery/registry/main.go index b2f94b6d..df172927 100644 --- a/reverseproxy/discovery/registry/main.go +++ b/reverseproxy/discovery/registry/main.go @@ -38,7 +38,7 @@ func main() { Weight: 10, }), ) - h.GET("/backend", func(cc context.Context, c *app.RequestContext) { + h.GET("/backend", func(ctx context.Context, c *app.RequestContext) { c.JSON(consts.StatusOK, utils.H{"ping": "pong"}) }) h.Spin() diff --git a/reverseproxy/standard/main.go b/reverseproxy/standard/main.go index cf7fe814..ee3e6dd8 100644 --- a/reverseproxy/standard/main.go +++ b/reverseproxy/standard/main.go @@ -30,7 +30,7 @@ func main() { if err != nil { panic(err) } - h.GET("/proxy/backend", func(cc context.Context, c *app.RequestContext) { + h.GET("/proxy/backend", func(ctx context.Context, c *app.RequestContext) { if param := c.Query("who"); param != "" { c.JSON(200, utils.H{ "who": param, diff --git a/reverseproxy/tls/main.go b/reverseproxy/tls/main.go index b5e29ddd..c166897d 100644 --- a/reverseproxy/tls/main.go +++ b/reverseproxy/tls/main.go @@ -64,7 +64,7 @@ func main() { server.WithTransport(standard.NewTransporter), ) - h.GET("/backend", func(cc context.Context, c *app.RequestContext) { + h.GET("/backend", func(ctx context.Context, c *app.RequestContext) { c.JSON(200, utils.H{"msg": "pong"}) }) h.Spin() diff --git a/reverseproxy/use_middleware/main.go b/reverseproxy/use_middleware/main.go index 83236871..1f2bba3c 100644 --- a/reverseproxy/use_middleware/main.go +++ b/reverseproxy/use_middleware/main.go @@ -35,7 +35,7 @@ func main() { panic(err) } - r.Use(func(c context.Context, ctx *app.RequestContext) { + r.Use(func(ctx context.Context, c *app.RequestContext) { if ctx.Query("country") == "cn" { proxy.ServeHTTP(c, ctx) ctx.Response.Header.Set("key", "value") @@ -45,13 +45,13 @@ func main() { } }) - r.GET("/backend", func(c context.Context, ctx *app.RequestContext) { + r.GET("/backend", func(ctx context.Context, c *app.RequestContext) { ctx.JSON(200, utils.H{ "message": "pong1", }) }) - r2.GET("/backend", func(c context.Context, ctx *app.RequestContext) { + r2.GET("/backend", func(ctx context.Context, c *app.RequestContext) { ctx.JSON(200, utils.H{ "message": "pong2", }) diff --git a/route/main.go b/route/main.go index df8b2d35..e3f31eba 100644 --- a/route/main.go +++ b/route/main.go @@ -118,7 +118,7 @@ func RegisterGroupRouteWithMiddleware(h *server.Hertz) { // // Bind the middleware directly to the routing group example1 := h.Group("/example1", basic_auth.BasicAuth(map[string]string{"test": "test"})) - example1.GET("/ping", func(c context.Context, ctx *app.RequestContext) { + example1.GET("/ping", func(ctx context.Context, c *app.RequestContext) { ctx.String(consts.StatusOK, "ping") }) @@ -127,7 +127,7 @@ func RegisterGroupRouteWithMiddleware(h *server.Hertz) { // use `Use` method example2 := h.Group("/example2") example2.Use(basic_auth.BasicAuth(map[string]string{"test": "test"})) - example2.GET("/ping", func(c context.Context, ctx *app.RequestContext) { + example2.GET("/ping", func(ctx context.Context, c *app.RequestContext) { ctx.String(consts.StatusOK, "ping") }) } @@ -157,14 +157,14 @@ func RegisterParaRoute(h *server.Hertz) { // RegisterAnonFunOrDecRoute Use anonymous function or decorator to register routes func RegisterAnonFunOrDecRoute(h *server.Hertz) { - h.AnyEX("/ping", func(c context.Context, ctx *app.RequestContext) { + h.AnyEX("/ping", func(ctx context.Context, c *app.RequestContext) { ctx.String(consts.StatusOK, app.GetHandlerName(ctx.Handler())) }, "ping_handler") } // RegisterGetRoutesInfo Get route info func RegisterGetRoutesInfo(h *server.Hertz) { - h.GET("/getRoutesInfo", func(c context.Context, ctx *app.RequestContext) { + h.GET("/getRoutesInfo", func(ctx context.Context, c *app.RequestContext) { ctx.JSON(consts.StatusOK, utils.H{"ping": "pong"}) }) routeInfo := h.Routes() diff --git a/sentinel/hertz/server/main.go b/sentinel/hertz/server/main.go index 38d87bb5..5f90aa8f 100644 --- a/sentinel/hertz/server/main.go +++ b/sentinel/hertz/server/main.go @@ -54,18 +54,18 @@ func main() { h.Use(hertzSentinel.SentinelServerMiddleware( // customize resource extractor if required // method_path by default - hertzSentinel.WithServerResourceExtractor(func(c context.Context, ctx *app.RequestContext) string { + hertzSentinel.WithServerResourceExtractor(func(ctx context.Context, c *app.RequestContext) string { return "server_test" }), // customize block fallback if required // abort with status 429 by default - hertzSentinel.WithServerBlockFallback(func(c context.Context, ctx *app.RequestContext) { + hertzSentinel.WithServerBlockFallback(func(ctx context.Context, c *app.RequestContext) { ctx.AbortWithStatusJSON(400, utils.H{ "err": "too many request; the quota used up", "code": 10222, }) }), )) - h.GET("/server_test", func(c context.Context, ctx *app.RequestContext) {}) + h.GET("/server_test", func(ctx context.Context, c *app.RequestContext) {}) h.Spin() } diff --git a/tracer/hertz/server/main.go b/tracer/hertz/server/main.go index 363b4a58..e7aa6c44 100644 --- a/tracer/hertz/server/main.go +++ b/tracer/hertz/server/main.go @@ -84,7 +84,7 @@ func main() { // You can refer to the example to implement a tracer middleware yourself to get the metrics you want. h.Use(hertztracer.ServerCtx()) - h.GET("/ping", func(c context.Context, ctx *app.RequestContext) { + h.GET("/ping", func(ctx context.Context, c *app.RequestContext) { type PingReq struct { Name string `query:"name"` }