I have a for loop which iterates over a map of a string as key (keyString
) and a slice of type Data
(sliceValue
) as values. Inside that for loop I have a function process()
that takes the sliceValue
and keyString
and does some operation on it.
I want the process
function to be executed in parallel for all slices.
The code that I am mentioning is like this:
for keyString, sliceValue := range mapWithKeyStringAndSliceValue {
result, err := process(keyString, sliceValue)
// some other code after this
}
As I mentioned above, the process
function should be executed in parallel for all the sliceValues.
I looked at this question to get some idea but it has a bit different operation to do. I am new to channel and go routines and would appreciate any help!