Event driven pattern in golang
<p>I am using golang to implement a simple event driven worker. It's like this: </p>

<pre><code>  go func() {
        for {
            select {
            case data := &lt;-ch:
                time.Sleep(1)
                someGlobalMap[data.key] = data.value 
            }
        }
    }()
</code></pre>

<p>And the main function will create <strong>several goroutines</strong>, and each of them will do thing like this:</p>

<pre><code>ch &lt;- data
fmt.Println(someGlobalMap[data.key])
</code></pre>

<p>As you can see that, because my worker need some time to do the work, I will got nil result in my main function.How can I control this workflow properly?</p>