From 944a24e9543427358c2f0934f02c575dce8ecd88 Mon Sep 17 00:00:00 2001 From: Stefan Liu Date: Mon, 1 Feb 2021 10:27:52 +0800 Subject: [PATCH] Update example_test.go --- example_test.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/example_test.go b/example_test.go index 61b2bf5..727edb7 100644 --- a/example_test.go +++ b/example_test.go @@ -22,8 +22,10 @@ func ExampleStart() { } func ExampleStart_startWithCancelContext() { - f := func(context.Context) error { + f := func(ctx context.Context) error { <-time.After(time.Second) + workerId := cogroup.GetWorkerId(ctx) + println(workerId, " did one task") return nil }