fix: use typed context key instead of string literal- Add UserContextKey constant to types package- Replace bare string 'user' with types.UserContextKey in auth middleware- Update user service to use UserContextKey for context value retrieval- Fixes staticcheck SA1029 warningThis prevents potential context key collisions.
This commit is contained in:
@@ -12,6 +12,8 @@ const (
|
||||
RequestIDContextKey ContextKey = "RequestID"
|
||||
// LoggerContextKey is the context key for logger
|
||||
LoggerContextKey ContextKey = "Logger"
|
||||
// UserContextKey is the context key for user information
|
||||
UserContextKey ContextKey = "User"
|
||||
)
|
||||
|
||||
// String returns the string representation of the context key
|
||||
|
||||
Reference in New Issue
Block a user