[website] content/blog/pipelines: fix explicit cancellation example

0 views
Skip to first unread message

Gopher Robot (Gerrit)

unread,
Apr 14, 2026, 2:51:38 PM (20 hours ago) Apr 14
to Matt Van Horn, goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Mark Freeman, David Chase, golang...@luci-project-accounts.iam.gserviceaccount.com, golang-co...@googlegroups.com

Gopher Robot submitted the change

Change information

Commit message:
content/blog/pipelines: fix explicit cancellation example

The output goroutine in merge had an empty <-done case body, so
receiving a cancellation signal would silently fall through to the
next iteration of the for-range loop. The goroutine kept trying to
forward values from c instead of exiting, leaving senders blocked
when only one done value was available.

Add a labeled break so receiving from done exits both the select
and the outer for, mirroring the return statement used in the close
example (sqdone3.go).

Also bump gen(2, 3) to gen(2, 3, 5) so the counting cancellation
example actually exercises both done sends. With only two inputs,
at most one sender ends up blocked, and the second cancellation is
unused.

Fixes golang/go#78277
Change-Id: I212bdb41e1337da26e8559bf1b676980b57de5a0
Reviewed-by: Sean Liao <se...@liao.dev>
Reviewed-by: David Chase <drc...@google.com>
Reviewed-by: Mark Freeman <markf...@google.com>
Auto-Submit: Sean Liao <se...@liao.dev>
Files:
  • M _content/blog/pipelines/sqdone1.go
Change size: XS
Delta: 1 file changed, 5 insertions(+), 2 deletions(-)
Branch: refs/heads/master
Submit Requirements:
Open in Gerrit
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: merged
Gerrit-Project: website
Gerrit-Branch: master
Gerrit-Change-Id: I212bdb41e1337da26e8559bf1b676980b57de5a0
Gerrit-Change-Number: 765660
Gerrit-PatchSet: 2
Gerrit-Owner: Matt Van Horn <mvan...@gmail.com>
Gerrit-Reviewer: David Chase <drc...@google.com>
Gerrit-Reviewer: Gopher Robot <go...@golang.org>
Gerrit-Reviewer: Mark Freeman <markf...@google.com>
Gerrit-Reviewer: Sean Liao <se...@liao.dev>
open
diffy
satisfied_requirement
Reply all
Reply to author
Forward
0 new messages