I'm new to golang and kinda new to coding in general and I've been stuck on this problem. I've found multiple examples on how to do this with two layers of map but none of them scale well to three layers. I have some code that looks something like this with a nested map as part of a struct.
type someStruct struct {
// some other stuff
myMap map[int]map[int]map[int]string
}
func (s someStruct) aFunction() {
//need logic to initialize the map
s.myMap[1][2][3] = "string"
}
Obviously, without the map being initialized this throws a panic! assignment to nil entry in map. I need a way to initialize the nested map in the func that it's used in. Or in another easily callable func.