How to work with context.Context: an official blog post.



The documentation for context states:



“Contexts should not be stored inside a struct type, but instead passed to each function that needs it.”



This article expands on that advice with reasons and examples describing why it's important to pass Context rather than store it in another type.



https://blog.golang.org/context-and-structs