© 2026 LinearBytes Inc.
Search posts, tags, users, and pages
Sergey Sarbash
Going Go
Dealing with context I usually use efficient zero memory allocation struct{}-based keys. For example:
struct{}
type ReqIDKey struct{} ... ctx := context.WithValue(r.Context(), ReqIDKey{}, reqID)
Paul Di Gian
Thanks, it is indeed a great suggestion! I will incorporate it!