mirror of
https://github.com/golang/go
synced 2024-11-19 00:44:40 -07:00
7dc6b39912
The memoize store passes a detached context to the value getter function. This is important since if the value getter experiences a context cancellation it will end up caching context.Canceled, which you never want. When type checking, we were ignoring the detached context and using the "real" request context. This would cause the context.Canceled error to get cached and continue popping up in various situations. Fix by swapping the importer's context to the detached context. It is a little messy since the importer stores the context as a field. I added a defer to restore the original context since it doesn't seem correct to let the detached context escape the memoize function. Updates golang/go#33678 Change-Id: I20dd466b0072ac2e856adbe993364f77e93ab054 Reviewed-on: https://go-review.googlesource.com/c/tools/+/192719 Reviewed-by: Rebecca Stambler <rstambler@golang.org> Run-TryBot: Rebecca Stambler <rstambler@golang.org> |
||
---|---|---|
.. | ||
apidiff | ||
fastwalk | ||
gopathwalk | ||
imports | ||
jsonrpc2 | ||
lsp | ||
memoize | ||
module | ||
semver | ||
span | ||
telemetry | ||
testenv | ||
tool | ||
txtar | ||
xcontext |