You can read some more discussion about this recommendation at https://github.com/golang/go/issues/22602. (That's where I propose relaxing it somewhat, since I think the current phrasing is too strict.)
On Tue, Sep 24, 2019 at 7:42 PM <johnmr...@gmail.com> wrote: > > I've read the documentation recommended never to store a context in a struct. > I'm curious to know why that's a bad thing. Is it just because context is > request-scoped, and the struct may not be? Or is there more to it than that? > In other words, what can go wrong if you store a context in a struct? > > > (And what do we actually mean by request-scoped? Do we specifically mean "a > chain of function calls" or do we mean something more conceptual, like a > "request" received by a server?) > > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/golang-nuts/dad8b56c-add0-49bc-b53e-f4238f19ae4f%40googlegroups.com. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAGeFq%2BkzVWRW8%2BVCsPVSC7sRQqw%2Bh2zwA0bo0jL349HBuFx3MQ%40mail.gmail.com.