mirror of https://github.com/golang/go.git
internal/lsp/cache: add context cancellation check inside importerFunc
This change adds a check inside of the types.ImporterFunc to see if the context has been cancelled. Updates golang/go#34683 Change-Id: I0f12da0f8158ecda0eec00150ed6ff772c2f89c3 Reviewed-on: https://go-review.googlesource.com/c/tools/+/217257 Run-TryBot: Rohan Challa <rohan@golang.org> Reviewed-by: Rebecca Stambler <rstambler@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
97da75b46c
commit
d6d1b0d853
|
|
@ -309,6 +309,10 @@ func typeCheck(ctx context.Context, fset *token.FileSet, m *metadata, mode sourc
|
|||
rawErrors = append(rawErrors, e)
|
||||
},
|
||||
Importer: importerFunc(func(pkgPath string) (*types.Package, error) {
|
||||
// If the context was cancelled, we should abort.
|
||||
if ctx.Err() != nil {
|
||||
return nil, ctx.Err()
|
||||
}
|
||||
dep := deps[packagePath(pkgPath)]
|
||||
if dep == nil {
|
||||
// We may be in GOPATH mode, in which case we need to check vendor dirs.
|
||||
|
|
|
|||
Loading…
Reference in New Issue