So it turns out there is some simplification possible, by replacing
go func() {
for outputs != nil {
fmt.Println("...")
select {
case m, ok := <-outputs:
if !ok {
outputs = nil
break
}
fmt.Println(m)
}
}
}()
with a so much simpler
go func() {
for m := range outputs {
fmt.Println(m)
}
}()
ranging over the outputs channel will yield each message in the channel, even after it is closed, until all items have been iterated over, then we're done and the go-routine will return.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
So it turns out there is some simplification possible, by replacing
with a so much simpler
ranging over the outputs channel will yield each message in the channel, even after it is closed, until all items have been iterated over, then we're done and the go-routine will return.