diff options
Diffstat (limited to 'vendor/github.com/go-chi/chi/context.go')
-rw-r--r-- | vendor/github.com/go-chi/chi/context.go | 27 |
1 files changed, 0 insertions, 27 deletions
diff --git a/vendor/github.com/go-chi/chi/context.go b/vendor/github.com/go-chi/chi/context.go index 7dec3f0c01..8c97f214a9 100644 --- a/vendor/github.com/go-chi/chi/context.go +++ b/vendor/github.com/go-chi/chi/context.go @@ -4,7 +4,6 @@ import ( "context" "net/http" "strings" - "time" ) // URLParam returns the url parameter from a http.Request object. @@ -146,32 +145,6 @@ func (s *RouteParams) Add(key, value string) { s.Values = append(s.Values, value) } -// directContext provides direct access to the routing *Context object, -// while implementing the context.Context interface, thereby allowing -// us to saving 1 allocation during routing. -type directContext Context - -var _ context.Context = (*directContext)(nil) - -func (d *directContext) Deadline() (deadline time.Time, ok bool) { - return d.parentCtx.Deadline() -} - -func (d *directContext) Done() <-chan struct{} { - return d.parentCtx.Done() -} - -func (d *directContext) Err() error { - return d.parentCtx.Err() -} - -func (d *directContext) Value(key interface{}) interface{} { - if key == RouteCtxKey { - return (*Context)(d) - } - return d.parentCtx.Value(key) -} - // contextKey is a value for use with context.WithValue. It's used as // a pointer so it fits in an interface{} without allocation. This technique // for defining context keys was copied from Go 1.7's new use of context in net/http. |