You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 1563515
Browse filesBrowse the repository at this point in the historyBrowse files
Pass context to Do via request, instead of as a separate parameter.
Do(req *http.Request, v interface{})
It seems cleaner because it eliminates the question of where to put
context. With the previous version that took 3 parameters, it was
possible (in theory) to pass the context via request or via first
parameter. Now, that ambiguity is gone, there's only one way.
It should be most helpful in situations where you have a request
that was made elsewhere, and you want to preserve its original context,
so you don't have to do something as awkward as:
ghClient.Do(req.Context(), req, ...)
Instead, it's simply:
ghClient.Do(req, ...)
The vast majority of this commit was generated with:
gofmt -w -r 's.client.Do(ctx, req, x) -> s.client.Do(req.WithContext(ctx), x)' github/*.go
0 commit comments