]> Cypherpunks repositories - gostls13.git/commit
docs: clarify when APIs use context.Background.
authorMatt T. Proud <matt.proud@gmail.com>
Thu, 25 Feb 2021 00:03:35 +0000 (01:03 +0100)
committerJean de Klerk <deklerk@google.com>
Thu, 11 Mar 2021 16:37:38 +0000 (16:37 +0000)
commit0fc370c5d26353a865a29a01f093942c949d530a
tree80c940f284e55c84cf49bba24fc9d273bd86ef64
parentb8e9ec856c2b2d717ab14e85f43e00b532c4370a
docs: clarify when APIs use context.Background.

The Go standard library retrofitted context support onto existing APIs
using context.Background and later offered variants that directly
supported user-defined context value specification. This commit makes
that behavior clear in documentation and suggests context-aware
alternatives if the user is looking for one.

An example motivation is supporting code for use in systems that expect
APIs to be cancelable for lifecycle correctness or load
shedding/management reasons, as alluded to in
https://blog.golang.org/context-and-structs.

Updates #44143

Change-Id: I2d7f954ddf9b48264d5ebc8d0007058ff9bddf14
Reviewed-on: https://go-review.googlesource.com/c/go/+/296152
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Jean de Klerk <deklerk@google.com>
Trust: Jean de Klerk <deklerk@google.com>
Run-TryBot: Jean de Klerk <deklerk@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
src/crypto/tls/tls.go
src/database/sql/sql.go
src/net/dial.go
src/net/http/request.go
src/net/http/socks_bundle.go
src/net/lookup.go