valyala / fasthttp

Fast HTTP package for Go. Tuned for high performance. Zero memory allocations in hot paths. Up to 10x faster than net/http
MIT License
21.66k stars 1.75k forks source link

req was only use once. how do i NOT declare it as a variable? #1460

Closed kolinfluence closed 1 year ago

kolinfluence commented 1 year ago

req was only use once. how do i NOT declare it as a variable?

will this work or is it legit?

    var ctx fasthttp.RequestCtx
    ctx.Init(&fasthttp.Request, nil, nil)

now using

    var ctx fasthttp.RequestCtx
    var req fasthttp.Request
    ctx.Init(&req, nil, nil)
kolinfluence commented 1 year ago

it works as such