Accessing a map using its reference

De-reference the map first and then access it (Example on play):

(*sessions)[sid]

It's also noteworthy that maps are actually reference types and therefore there is a very limited use-case of using pointers. Just passing a map value to a function will not copy the content. Example on play.


You don't need to use a pointer with a map.

Map types are reference types, like pointers or slices

If you needed to change the Session you could use a pointer:

map[string]*Session