Tips and Tricks

    Using gorilla/context for request-specific data

    It is pretty often that we need to store and retrieve data that is specific to
    the current HTTP request. Use gorilla/context to map values and retrieve them
    later. It contains a global mutex on a map of request objects.

    1. val := context.Get(r, "myKey")
    2. // ...
    3. }