diff --git a/multireader.go b/multireader.go index 511aeec..35fdfab 100644 --- a/multireader.go +++ b/multireader.go @@ -21,7 +21,7 @@ func tickReader(sem chan struct{}, ticker *time.Ticker, s string) io.Reader { fmt.Fprintf(w, "%s with %v\n", s, t) default: // try to comment this and then run :) } - <-sem // add a ticket to the semaphore + <-sem // add a ticket to the semaphore } }() return r @@ -46,7 +46,7 @@ func main() { var ( wg sync.WaitGroup semaphore = make( - chan struct{}, + chan struct{}, 1, // only one goroutine can do its thing ) )