]> Cypherpunks repositories - gostls13.git/commit
context: use "canceled" in docs to refer to timed-out contexts
authorDamien Neil <dneil@google.com>
Fri, 3 Jan 2025 19:47:39 +0000 (11:47 -0800)
committerGopher Robot <gobot@golang.org>
Fri, 3 Jan 2025 22:30:13 +0000 (14:30 -0800)
commitf966695ccea356e4e4e8cc0328276e2d00c9fc1e
tree29297273c95f764be5fe37155ad35af2390949a0
parent5da026354c0229c5a61dbe907c080cef7adc11bc
context: use "canceled" in docs to refer to timed-out contexts

In documentation, we've usually but not always referred to a
context with a closed Done channel as "done" rather than
"canceled", to avoid ambiguity between a context canceled
by calling a CancelFunc and one past its deadline.

This actually adds ambiguity, however, since it's common to
see references to a "canceled context" that are intended to
cover contexts past their deadline. If you see "function F
returns if its context is canceled", you can reasonably
assume that F will return if its context passes its
deadline, unless something says otherwise.

Update the context package docs to explicitly state that
a context is canceled when its deadline passes. Drop references
to contexts becoming "done" and just use "canceled" throughout.

Fixes #70945

Change-Id: I99fbd800c6049deaa37015a304f7f9d9a84100e1
Reviewed-on: https://go-review.googlesource.com/c/go/+/640095
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Damien Neil <dneil@google.com>
src/context/context.go
src/context/example_test.go