1
0
mirror of https://github.com/golang/go synced 2024-11-18 15:54:42 -07:00

context: document that Err is unspecified before Done

It could have been defined the other way, but since the behavior has
been unspecified, this is the conservative approach for people writing
different implementations of the Context interface.

Change-Id: I7334a4c674bc2330cca6874f7cac1eb0eaea3cff
Reviewed-on: https://go-review.googlesource.com/37375
Reviewed-by: Matt Layher <mdlayher@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Sameer Ajmani <sameer@golang.org>
Run-TryBot: Sameer Ajmani <sameer@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Ian Lance Taylor 2017-02-21 12:48:45 -08:00
parent ea48c9d232
commit dc6af19ff8

View File

@ -100,6 +100,7 @@ type Context interface {
// Canceled if the context was canceled or DeadlineExceeded if the // Canceled if the context was canceled or DeadlineExceeded if the
// context's deadline passed. No other values for Err are defined. // context's deadline passed. No other values for Err are defined.
// After Done is closed, successive calls to Err return the same value. // After Done is closed, successive calls to Err return the same value.
// Err's return value is unspecified before Done is closed.
Err() error Err() error
// Value returns the value associated with this context for key, or nil // Value returns the value associated with this context for key, or nil