I don\'t understand why the deadlock is occurring in this code. I\'ve tried several different things to get the deadlock to stop (several different versions using WorkGroup)
You never close the "truck" channel ch, so UnloadTrucks never returns.
ch
UnloadTrucks
You can close the channel after all workers are done, by using a WaitGroup:
go func() { wg.Wait() close(ch) }() UnloadTrucks(ch)
http://play.golang.org/p/1V7UbYpsQr