You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
should not use built-in type string as key for value; define your own type to avoid collisions
Description
To prevent clashes across packages using context, the provided key must be similar and should not be of type string or any other built-in type. Users of WithValue must provide their key types.
To avoid allocating when assigning to an interface{}, context keys often have concrete type struct{}. Alternatively, exported context key variables’ static type should be a pointer or interface.
The text was updated successfully, but these errors were encountered:
handler_go17_test.go
should not use built-in type string as key for value; define your own type to avoid collisions
Description
To prevent clashes across packages using context, the provided key must be similar and should not be of type
string
or any other built-in type. Users ofWithValue
must provide their key types.To avoid allocating when assigning to an
interface{}
, context keys often have concrete typestruct{}
. Alternatively, exported context key variables’ static type should be a pointer or interface.The text was updated successfully, but these errors were encountered: