package main import "fmt" func worker(queue chan *Utterance, done chan bool, worknumber int, geshaft chan *Utterance) { for { if len(queue) == 0 { fmt.Println("empty queue, number", worknumber) return } select { case ut := <-queue: if err := cutoutClipAndTranscode(ut); err == nil { geshaft <- ut } case <-done: fmt.Println("done signal, number", worknumber) return } } } func cutterQueue(fQueue chan string, workerID int) { for { if len(fQueue) == 0 { fmt.Println("empty queue, number", workerID) return } fpath := <-fQueue cutOnEqualParts(fpath, segmentSize) } }