Skip to content

Instantly share code, notes, and snippets.

@pior
Created February 28, 2020 15:23
Show Gist options
  • Save pior/e0d1222c3af0c33e5f8cf340b6dfef5c to your computer and use it in GitHub Desktop.
Save pior/e0d1222c3af0c33e5f8cf340b6dfef5c to your computer and use it in GitHub Desktop.
func BackgroundWithValues(contextForValues context.Context) context.Context {
return cancellationBlockerContext{context.Background(), contextForValues}
}
type cancellationBlockerContext struct {
context.Context
valueCtx context.Context
}
func (c *valuesContext) Value(key interface{}) interface{} {
return c.valueCtx.Value(key)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment