I'm rather new in go, and I searched for this trouble on this site, and founed answered questions, but cannot implement those answers to my case. I have a code :
func receiveWork(out <-chan Work) map[string][]ChartElement {
var countedData map[string][]ChartElement
for el := range out {
countedData[el.Name] = el.Data
}
fmt.Println("This is never executed !!!")
return countedData
}
there are no troubles with structs outside this method. Also Println
not executes(as test that panic is here). I understands that the trouble is in incrementing data to the structure.
There are some goroutines , that are sending data to channel, and receiveWork
method rgabs it all and should make a map like this:
map =>
"typeOne" =>
[
ChartElement,
ChartElement,
ChartElement,
],
"typeTwo" =>
[
ChartElement,
ChartElement,
ChartElement,
]
How to realize this inserting in a proper way?