Why can you reuse channels in Go when doing parallel processing?
<p>Here is a code snippet from the <a href="https://tour.golang.org/concurrency/2" rel="nofollow">official tutorial</a></p>

<pre><code>package main

import "fmt"

func sum(s []int, c chan int) {
    sum := 0
    for _, v := range s {
        sum += v
    }
    c &lt;- sum // send sum to c
}

func main() {
    s := []int{7, 2, 8, -9, 4, 0}

    c := make(chan int)
    go sum(s[:len(s)/2], c)
    go sum(s[len(s)/2:], c)
    x, y := &lt;-c, &lt;-c // receive from c

    fmt.Println(x, y, x+y)
}
</code></pre>

<p>Since we are doing the calculation in parallel, and each thread saves its result into the same channel, doesn't this screw up the data?</p>