1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
moby--moby/vendor/github.com/moby/buildkit/session/context.go
Tonis Tiigi ed6fd3d95b vendor: update buildkit
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2017-09-21 22:17:43 -07:00

22 lines
386 B
Go

package session
import "context"
type contextKeyT string
var contextKey = contextKeyT("buildkit/session-id")
func NewContext(ctx context.Context, id string) context.Context {
if id != "" {
return context.WithValue(ctx, contextKey, id)
}
return ctx
}
func FromContext(ctx context.Context) string {
v := ctx.Value(contextKey)
if v == nil {
return ""
}
return v.(string)
}