throw: all goroutines are asleep – deadlock
As you never close the ch channel, the range loop will never finish. You can’t send back the result on the same channel. A solution is to use a different one. Your program could be adapted like this : package main import ( “fmt” ) func total(in chan int, out chan int) { res := … Read more