From a4e9122f10c5ab41ebe4595674c7e2acb8737ac7 Mon Sep 17 00:00:00 2001 From: Rebecca Stambler Date: Fri, 31 May 2019 23:34:02 -0400 Subject: [PATCH] internal/lsp: fix regression from CL 179439 Fixes golang/go#32378 Change-Id: I7c5b794ba6137084a56e3e7bf8027a6f65819b34 Reviewed-on: https://go-review.googlesource.com/c/tools/+/179919 Run-TryBot: Rebecca Stambler Reviewed-by: Ian Cottrell --- internal/lsp/cache/pkg.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/lsp/cache/pkg.go b/internal/lsp/cache/pkg.go index eeb14033..9cf86b49 100644 --- a/internal/lsp/cache/pkg.go +++ b/internal/lsp/cache/pkg.go @@ -161,5 +161,9 @@ func (pkg *pkg) IsIllTyped() bool { } func (pkg *pkg) GetImport(pkgPath string) source.Package { - return pkg.imports[pkgPath] + if imp := pkg.imports[pkgPath]; imp != nil { + return imp + } + // Don't return a nil pointer because that still satisfies the interface. + return nil }