concurrent map read and write when there is no concurrency : <p>The following go play example shows in a simplistic way what I have defined. I am passing a map as a copied value to a function (not a reference) as well as there is a recursion in my function which I assume passes by value as well. </p>

<p><a href="https://play.golang.org/p/na6y6Wih4M" rel="nofollow noreferrer">https://play.golang.org/p/na6y6Wih4M</a></p>

<pre><code>// this function has no write operations to dataMap, just reads
// dataMap, in fact, has no write operations since it was copied
func findParentAncestors(ID int, dataMap map[int]Data) []Data {
    results := []Data{}
    if _, ok := dataMap[ID]; ok {
        if parentData, ok := dataMap[dataMap[ID].ParentID]; ok {
            results = append(results, parentData)
            // recursion
            results = append(results, findParentAncestors(parentData.ID, dataMap)...)
        }
    }
    return results
}
</code></pre>

<p>PROBLEM: somehow along my program execution, which involves much more data than this example (obviusly), an error <strong>"fatal error: concurrent map read and map write"</strong> points function <em>findParentAncestors()</em>:</p>

<pre><code>main.findParentAncestors(0x39e3, 0xc82013ac90, 0x0, 0x0, 0x0)
    /opt/test/src/test.go:17 +0xa6 fp=0xc820269fb8 sp=0xc820269bd0
main.findParentAncestors(0x5d25, 0xc82013ac90, 0x0, 0x0, 0x0)
    /opt/test/src/test.go:21 +0x239 fp=0xc82026a3a0 sp=0xc820269fb8
</code></pre>
