Either the doc should be changed or the std lib should follow the spirit of the doc. But my understanding is that context.Context is not just about HTTP request/response cycle but deals with anything that needs cancellation or a resource clean up signal , some kind of DIY RAII . In any case the documentation should be clarified.
Le mardi 6 décembre 2016 16:48:48 UTC+1, Chandra Sekar S a écrit : > > Documentation of the context package says, > > "Use context Values only for request-scoped data that transits processes > and APIs, not for passing optional parameters to functions." > > sql.BeginContext introduced in 1.8, uses Context to receive options like > IsolationLevel and read-only flag. These are neither request-specific nor > cross-cutting. They are options that are typically specific to a type of > operation, but common to all requests. > > Isn't this use in db/sql contradicting the recommendation in context's doc? > > -- > Chandra Sekar.S > -- 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. For more options, visit https://groups.google.com/d/optout.