Archive of stories published by Random Go tips

On context.Context keys uniqueness

After reading the blog post introducing context.Context, I got used to using integers as context.Context keys.

Here is a code sample taken from the blog post :

// userIPkey is the context key for the user IP address…