From 59731289e9179b93dc7b5392c6a0fdb9774f5ec0 Mon Sep 17 00:00:00 2001 From: Muir Manders Date: Wed, 9 Oct 2019 11:11:22 -0700 Subject: [PATCH] internal/lsp: include context in go/packages config Include the context when invoking go/packages.Load so it is cancelable. Otherwise if the user is manually typing an import or otherwise messing around with imports, a big queue of potentially very slow go/packages.Load calls will build up. Fixes golang/go#34414. Change-Id: I80732086b478b908c720739708dd773e81fe2b81 Reviewed-on: https://go-review.googlesource.com/c/tools/+/200058 Run-TryBot: Rebecca Stambler Reviewed-by: Rebecca Stambler --- internal/lsp/cache/view.go | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/lsp/cache/view.go b/internal/lsp/cache/view.go index 436ae3a535..0104799ee7 100644 --- a/internal/lsp/cache/view.go +++ b/internal/lsp/cache/view.go @@ -109,6 +109,7 @@ func (v *view) Config(ctx context.Context) *packages.Config { // TODO: Should we cache the config and/or overlay somewhere? return &packages.Config{ Dir: v.folder.Filename(), + Context: ctx, Env: v.options.Env, BuildFlags: v.options.BuildFlags, Mode: packages.NeedName |