go/src/context
Bryan C. Mills 3d49b683c6 context: eliminate arbitrary timeouts in examples
ExampleWithDeadline and ExampleWithTimeout used an arbitrary 1-second
timeout for a “blocked” select case, which could fail if the test
goroutine happens to be descheduled for over a second, or perhaps if
an NTP synchronization happens to jump by a second at just the right
time.

Either case is plausible, especially on a heavily-loaded or slow
machine (as is often the case for builders for unusual ports).

Instead of an arbitrary timeout, use a “ready” channel that is never
actually ready.

Fixes #57594.

Change-Id: I9ff68f50b041a3382e7b267c28c5259e886a9d23
Reviewed-on: https://go-review.googlesource.com/c/go/+/460999
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Sameer Ajmani <sameer@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
2023-01-25 21:12:45 +00:00
..
benchmark_test.go context: implement Context.Value using iteration rather than recursion 2021-10-02 00:44:24 +00:00
context.go context: add APIs for setting a cancelation cause when deadline or timer expires 2023-01-20 21:41:01 +00:00
context_test.go context: add APIs for setting a cancelation cause when deadline or timer expires 2023-01-20 21:41:01 +00:00
example_test.go context: eliminate arbitrary timeouts in examples 2023-01-25 21:12:45 +00:00
net_test.go
x_test.go context: add lock in Cause to avoid race 2022-11-28 19:33:02 +00:00