How can I define a map, where the key points to an address of a struct?
i.e.
type A struct {
id int
}
sessions = make(map[int]&A)
first := &A{6}
sessions[0] = first
How can I define a map, where the key points to an address of a struct?
i.e.
type A struct {
id int
}
sessions = make(map[int]&A)
first := &A{6}
sessions[0] = first
Almost all in your code is fine, you only use a wrong declaration of pointer:
sessions := make(map[int]*A)
first := A{6}
sessions[0] = &first