-
Notifications
You must be signed in to change notification settings - Fork 1
Closed
Description
You are embedding a context which is an anti pattern.
Here is the containedctx linter available in golangci-lint
https://github.com/sivchari/containedctx
You can look at the blog post it mentions.
As you are only using ctx.WithValue
I would expect your code to do not define AppContext, and add method to it, but define your app signatures like this
func GetUserID(ctx context.Context) (string, bool)
func SetUserID(ctx context. Context, userID string) context. Contextinstead of
func (sc *AppContext) UserID() (string, bool)
func (sc *AppContext) SetUserID(userID string) AppContextMetadata
Metadata
Assignees
Labels
No labels