The following code waits for the 'results' channel to be empty and then the DEFAULT branch breaks to Label DONE.
Now the question: Why does this break the FOR LOOP?? It seems that the FOR loop would continue to skip to DEFAULT and never end.
WHAT IS BREAKING THE FOR LOOP.
The Output is as follows:
Break DONE
End For
...
DONE:
for {
select { // Nonblocking
case result := <-results:
fmt.Printf("%s:%d:%s
", result.filename, result.lino,
result.line)
default:
fmt.Println("Break DONE")
break DONE
}
fmt.Println("END Select")
}
fmt.Println("End For")