In go-fiber docs they say:
As a rule of thumb, you must only use context values within the handler, and you must not keep any references
is it OK if I passing around the context as a function argument like this:
func GetList(c *fiber.Ctx) error {
result, err := User.Search(c)
}
func Search(c *fiber.Ctx) (User, err) {
id := c.Params("id")
}
is that considered as a bad practice?
And I don't really understand this sentence:
As soon as you return from the handler, any values you have obtained from the context will be re-used in future requests and will change below your feet.
So if I have sent the response to the client the value of params will be reused? reused by whom? by me or by other people's request?
func GetList(c *fiber.Ctx) error {
id := c.Params("id") // 911
return c.SendString("Hello, World!")
}
so if the value of id was 911 does that mean other people request will also result in 911?
and what's the meaning of
will change below your feet
can anyone elaborate more easy for beginner like me to understand? thanks...