]> Cypherpunks repositories - gostls13.git/commit
context: avoid key collisions in test afterfunc map
authorDamien Neil <dneil@google.com>
Thu, 7 Sep 2023 16:27:50 +0000 (09:27 -0700)
committerDamien Neil <dneil@google.com>
Mon, 18 Sep 2023 16:58:52 +0000 (16:58 +0000)
commit0f1227c507c62b635a3b4b85f5b7a967df72b59f
tree52063568914fd2dd2f4f3c2afbbd7fdef168dc1d
parent089cc6867619da6d6a901b3835475206759c47a2
context: avoid key collisions in test afterfunc map

The afterFuncContext type, used only in tests, contains a
set of registered afterfuncs indexed by an arbitrary unique key.

That key is currently a *struct{}. Unfortunately, all
*struct{} pointers are equal to each other, so all registered
funcs share the same key. Fortunately, the tests using this
type never register more than one afterfunc.

Change the key to a *byte.

Change-Id: Icadf7d6f258e328f6e3375846d29ce0f98b60924
Reviewed-on: https://go-review.googlesource.com/c/go/+/526655
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
src/context/afterfunc_test.go