1
0
mirror of https://github.com/golang/go synced 2024-11-18 19:44:46 -07:00
go/internal/lsp/cache
Muir Manders 7dc6b39912 internal/lsp: use memoize store's context when type checking
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>
2019-09-04 20:12:04 +00:00
..
cache.go internal/lsp: remove the non context xlog path 2019-07-15 03:45:47 +00:00
check.go internal/lsp: use memoize store's context when type checking 2019-09-04 20:12:04 +00:00
external.go internal/lsp: split the telemetry library out 2019-08-15 21:28:02 +00:00
file.go internal/lsp: cache the *ast.File and *token.File on the package 2019-07-16 19:44:59 +00:00
gofile.go internal/lsp: use protocol.Ranges for source.Identifier 2019-08-29 05:14:58 +00:00
load.go internal/lsp: unlabel context, log errors when canceled 2019-08-20 20:39:21 +00:00
modfile.go internal/lsp: use x/xerrors to create new errors 2019-08-06 19:46:56 +00:00
parse.go internal/lsp: unlabel context, log errors when canceled 2019-08-20 20:39:21 +00:00
pkg.go go/analysis: handle common nil pointers 2019-08-24 21:01:00 +00:00
session.go internal/lsp: start handling watched file change events 2019-08-26 19:00:32 +00:00
sumfile.go internal/lsp: use x/xerrors to create new errors 2019-08-06 19:46:56 +00:00
token.go internal/lsp: unlabel context, log errors when canceled 2019-08-20 20:39:21 +00:00
view.go x/tools/gopls: add fallback to default GOPATH if missing 2019-08-30 08:22:54 +00:00
watcher.go internal/lsp: fix deadlocks loading lots of files at once 2019-07-03 17:22:52 +00:00