GoPLS Viewer

Home|gopls/internal/xcontext/xcontext.go
1// Copyright 2019 The Go Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5// Package xcontext is a package to offer the extra functionality we need
6// from contexts that is not available from the standard context package.
7package xcontext
8
9import (
10    "context"
11    "time"
12)
13
14// Detach returns a context that keeps all the values of its parent context
15// but detaches from the cancellation and error handling.
16func Detach(ctx context.Contextcontext.Context { return detachedContext{ctx} }
17
18type detachedContext struct{ parent context.Context }
19
20func (v detachedContextDeadline() (time.Timebool)       { return time.Time{}, false }
21func (v detachedContextDone() <-chan struct{}             { return nil }
22func (v detachedContextErr() error                        { return nil }
23func (v detachedContextValue(key interface{}) interface{} { return v.parent.Value(key) }
24
MembersX
detachedContext
detachedContext.Deadline
detachedContext.Done.v
time
detachedContext.Deadline.v
detachedContext.Done
detachedContext.Value
context
Detach
detachedContext.parent
detachedContext.Err.v
detachedContext.Err
detachedContext.Value.v
detachedContext.Value.key
Detach.ctx
Members
X