Skip to content

Commit d227ad8

Browse files
committed
fix: lint
1 parent 41cece4 commit d227ad8

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

route.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -82,18 +82,18 @@ func NewRoute(config config.Config, parameters map[string]any) (*Route, error) {
8282
// Fallback 设置回退处理程序
8383
func (r *Route) Fallback(handler httpcontract.HandlerFunc) {
8484
r.instance.Use(func(c fiber.Ctx) error {
85-
context := contextPool.Get().(*Context)
85+
ctx := contextPool.Get().(*Context)
8686

87-
context.instance = c
88-
if response := handler(context); response != nil {
87+
ctx.instance = c
88+
if response := handler(ctx); response != nil {
8989
return response.Render()
9090
}
9191

92-
contextRequestPool.Put(context.request)
93-
contextResponsePool.Put(context.response)
94-
context.request = nil
95-
context.response = nil
96-
contextPool.Put(context)
92+
contextRequestPool.Put(ctx.request)
93+
contextResponsePool.Put(ctx.response)
94+
ctx.request = nil
95+
ctx.response = nil
96+
contextPool.Put(ctx)
9797

9898
return nil
9999
})

utils.go

+2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ func handlerToFiberHandler(handler httpcontract.HandlerFunc) fiber.Handler {
2525
return func(c fiber.Ctx) error {
2626
context := contextPool.Get().(*Context)
2727
context.instance = c
28+
2829
if response := handler(context); response != nil {
2930
return response.Render()
3031
}
@@ -43,6 +44,7 @@ func middlewareToFiberHandler(middleware httpcontract.Middleware) fiber.Handler
4344
return func(c fiber.Ctx) error {
4445
context := contextPool.Get().(*Context)
4546
context.instance = c
47+
4648
middleware(context)
4749

4850
contextRequestPool.Put(context.request)

0 commit comments

Comments
 (0)