mirror of
https://github.com/Crocmagnon/fatcontext.git
synced 2025-02-05 20:22:32 +01:00
24 lines
331 B
Go
24 lines
331 B
Go
|
package common
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
)
|
||
|
|
||
|
type Container struct {
|
||
|
Ctx context.Context
|
||
|
}
|
||
|
|
||
|
func something() func(*Container) {
|
||
|
return func(r *Container) {
|
||
|
ctx := r.Ctx
|
||
|
ctx = context.WithValue(ctx, "key", "val")
|
||
|
r.Ctx = ctx
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func blah(r *Container) {
|
||
|
ctx := r.Ctx
|
||
|
ctx = context.WithValue(ctx, "key", "val")
|
||
|
r.Ctx = ctx
|
||
|
}
|