Accessing a map using its reference

前端 未结 3 1184
悲&欢浪女
悲&欢浪女 2021-02-01 05:53

I try to loop through a map, that I pass as a pointer to a function, but I can\'t find a way to access the elements. This is the code:

func refreshSession(sessio         


        
3条回答
  •  暖寄归人
    2021-02-01 06:03

    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

提交回复
热议问题