MCPcopy Create free account
hub / github.com/belak/gitdir / CtxUser

Function CtxUser

context.go:56–62  ·  view source on GitHub ↗

CtxUser pulls the current User out of the context, or AnonymousUser if not set.

(ctx context.Context)

Source from the content-addressed store, hash-verified

54// CtxUser pulls the current User out of the context, or AnonymousUser if not
55// set.
56func CtxUser(ctx context.Context) *User {
57 if u, ok := ctx.Value(contextKeyUser).(*User); ok {
58 return u
59 }
60
61 return AnonymousUser
62}
63
64// WithLogger takes a parent context and a logger and returns a new context
65// with that logger.

Callers 3

TestCtxUserFunction · 0.85
CtxExtractFunction · 0.85
cmdWhoamiFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestCtxUserFunction · 0.68