MCPcopy Create free account
hub / github.com/go-chi/chi / contextKey

Struct contextKey

context.go:160–162  ·  view source on GitHub ↗

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.

Source from the content-addressed store, hash-verified

158// a pointer so it fits in an interface{} without allocation. This technique
159// for defining context keys was copied from Go 1.7's new use of context in net/http.
160type contextKey struct {
161 name string
162}
163
164func (k *contextKey) String() string {
165 return "chi context value " + k.name

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected