]> Cypherpunks repositories - gostls13.git/commit
context: improve valueCtx.String
authorJoe Tsai <joetsai@digital-static.net>
Sat, 13 Jan 2024 00:28:56 +0000 (16:28 -0800)
committerGopher Robot <gobot@golang.org>
Fri, 9 Feb 2024 00:58:17 +0000 (00:58 +0000)
commit2057ad02bd8387378a2d1fd637e955e126f698bf
tree48d2c7af11c774d8a4b6ef75cc5c0fc2f9504cfa
parentdba518999dfb7212f6fbc42d85dd303fcb78baad
context: improve valueCtx.String

Check for stringer on the key itself.
This is useful for locally defined context key types,
where there may be multiple instances of that type.
For example, see http.contextKey,
which can now be called after this change.

For the value itself, print the type at least
instead of just resorting to "<not stringer>".

Change-Id: I588ef1df34e90fb9ebd83cb180fea495e1fedaa8
Reviewed-on: https://go-review.googlesource.com/c/go/+/555697
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Joseph Tsai <joetsai@digital-static.net>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Joseph Tsai <joetsai@digital-static.net>
TryBot-Result: Gopher Robot <gobot@golang.org>
src/context/context.go
src/context/x_test.go