From 60c49f9f7dfbc8718a62a3b8a081a85c2de504fb Mon Sep 17 00:00:00 2001 From: "Stephen McQuay (smcquay)" Date: Tue, 12 Dec 2017 13:25:20 -0800 Subject: [PATCH] Don't kick off all goroutines at once --- main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.go b/main.go index f944719..c2fa846 100644 --- a/main.go +++ b/main.go @@ -40,9 +40,9 @@ func main() { wg := sync.WaitGroup{} sema := make(chan bool, *conc) for w := range work { + sema <- true wg.Add(1) go func(j job) { - sema <- true defer func() { wg.Done() <-sema