Passing any value over cancel channel causes program to hang
<p>I am trying to use worker goroutines to check diameters out to a certain distance, it works great when I do one tile at a time, but when I do a bunch, there is a massive slow down. I figure this is because a lot of goroutines are still running even though they are no longer needed. I added a fail channel to tell all running goroutines to close up shop, but doing this causes the app to hang. Actually, passing any value to the channel causes the app to hang, even if I don't consume it.</p>

<pre><code> caught := 0
loop:
    for angle := float64(0); angle &lt; 360; angle++ {
        select {
        case &lt;-failChannel:
            break loop
        default:
         log.Print(angle)
        }

    }
    channelOut &lt;- []int{radius, caught}
</code></pre>

<p>is the routine that uses the channel </p>

<pre><code>for {
        select {
        case circle := &lt;-channelOut:
            if circle[1] == 0 {
                radiusMap[circle[0]] = 0
                if _, radius := testLine(radiusMap); radius &lt;= circle[0] {
                    failChannel &lt;- 0


                }
            } else {
                radiusMap[circle[0]] = 1

            }

        default:    
        }
    }
</code></pre>

<p>Is the loop that will pass the int to the failChannel. I am doing an int channel because I want to see if a lower radius failed, and if so stop. I made it just any int right now as a test. </p>

<p>Does anyone have any clue why this would be hanging? It doesn't seem to make sense to me. </p>