From 0f0b22bf6b51c0cfe8f13bd5815143fa4e75b1b8 Mon Sep 17 00:00:00 2001 From: Andrew Gerrand Date: Thu, 9 Feb 2017 12:41:51 +1100 Subject: content: fix example in "Go concurrency patterns" article To quote Tim Scheuermann, who alerted me to this issue: The text states that the channel should be buffered for the last example to work, but the channel is already buffered. I tried to use the codereview tool to commit the patch, but it refuses to work on a github repository. The fix is trivial, remove the buffer from line 2 of the example. Thanks to Ivan Kurnosov for finding it in the first place. Change-Id: I003f1fc0cbbb645be776eeb55d46ee3462fdf4d7 Reviewed-on: https://go-review.googlesource.com/36670 Reviewed-by: Chris Broadfoot --- content/go-concurrency-patterns-timing-out-and.article | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'content/go-concurrency-patterns-timing-out-and.article') diff --git a/content/go-concurrency-patterns-timing-out-and.article b/content/go-concurrency-patterns-timing-out-and.article index 9d60ead..fa81a2c 100644 --- a/content/go-concurrency-patterns-timing-out-and.article +++ b/content/go-concurrency-patterns-timing-out-and.article @@ -32,7 +32,7 @@ Let's look at another variation of this pattern. In this example we have a progr The function `Query` takes a slice of database connections and a `query` string. It queries each of the databases in parallel and returns the first response it receives: func Query(conns []Conn, query string) Result { - ch := make(chan Result, 1) + ch := make(chan Result) for _, conn := range conns { go func(c Conn) { select { -- cgit v1.2.3