Skip to content

Commit

Permalink
Simplify context (#4706)
Browse files Browse the repository at this point in the history
Replace complex Context construct with a simpler immutible struct.
Only breaking change is not to support `Value` and `GetValue` as first class calls.
We do embed ctx.Context() as a raw context.Context instead to be used as you see fit.
  • Loading branch information
ethanfrey authored and Alessio Treglia committed Jul 16, 2019
1 parent 6ca6418 commit d3bb9f5
Show file tree
Hide file tree
Showing 3 changed files with 191 additions and 284 deletions.
11 changes: 11 additions & 0 deletions .pending/improvements/sdk/4706-Simplify-context
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
4706 - Simplify context

Replace complex Context construct with a simpler immutible struct.
Only breaking change is not to support `Value` and `GetValue` as first class calls.
We do embed ctx.Context() as a raw context.Context instead to be used as you see fit.

Migration guide:
`ctx = ctx.WithValue(contextKeyBadProposal, false)` ->
`ctx = ctx.WithContext(context.WithValue(ctx.Context(), contextKeyBadProposal, false))`
A bit more verbose, but also allows `context.WithTimeout()`, etc and only used
in one function in this repo, in test code.
Loading

0 comments on commit d3bb9f5

Please sign in to comment.