The Golang standard library comes with a simple interface, context.Context, which is a little harder to understand and use than the others. The difficulties in getting the context.Context interface may be the naming, maybe not super appropriate. In t...
Markdown supported · ⌘↵ to post
Sergey Sarbash
Going Go
Dealing with context I usually use efficient zero memory allocation
struct{}-based keys. For example:type ReqIDKey struct{} ... ctx := context.WithValue(r.Context(), ReqIDKey{}, reqID)