How do you manage context?

I’m not super familiar with Go or its context package, but I’d say it probably depends on the context (ba dum tsch), or what exactly you’re wanting to do.

Like for logging, the Log module has fiber specific context that you can use to apply some data to all messages regardless of where they’re logged. Otherwise if you’re in the context of a web request, the framework might provide some way to do it. Do you have some more specific examples in mind?

Related: Fiber-local state?

2 Likes