Overview
Go client libraries typically accept a context.Context as the first
argument in all outgoing function calls. The context carries deadline and
other information across API boundaries. See also https://blog.golang.org/context.
Popular examples are,
Context also allows orchestrating cancelation, especially with concurrent
operations. Support for this is already built into http.Client.
Implementation
All methods that make an outgoing request would have to accept a
context.Context as their first argument and plumb it over to http.Client
with req.WithContext(ctx), likely in buildRequest or prepareRequest.
Because this will involve a breaking change to the API, it should probably be
bundled with any other breaking changes you have planned.
Overview
Go client libraries typically accept a context.Context as the first
argument in all outgoing function calls. The context carries deadline and
other information across API boundaries. See also https://blog.golang.org/context.
Popular examples are,
Context also allows orchestrating cancelation, especially with concurrent
operations. Support for this is already built into
http.Client.Implementation
All methods that make an outgoing request would have to accept a
context.Contextas their first argument and plumb it over tohttp.Clientwith
req.WithContext(ctx), likely in buildRequest or prepareRequest.Because this will involve a breaking change to the API, it should probably be
bundled with any other breaking changes you have planned.