api: fix golint suggestion for proper context usage

api/user-auth.go:27:5  golint  should not use basic type string as key in context.WithValue

Signed-off-by: Roman Khimov <roman@nspcc.ru>
This commit is contained in:
Roman Khimov 2021-05-26 21:25:05 +03:00
parent 184c26551a
commit 1c277bd97b

View file

@ -9,8 +9,11 @@ import (
"go.uber.org/zap"
)
// KeyWrapper is wrapper for context keys.
type KeyWrapper string
// BearerTokenKey is an ID used to store bearer token in a context.
const BearerTokenKey = "__context_bearer_token_key"
var BearerTokenKey = KeyWrapper("__context_bearer_token_key")
// AttachUserAuth adds user authentication via center to router using log for logging.
func AttachUserAuth(router *mux.Router, center auth.Center, log *zap.Logger) {