1
0
mirror of https://github.com/golang/go synced 2024-11-18 19:44:46 -07:00

internal/lsp: modify check for a missing package

Trying again. Apparently it's useful to run tests before submitting
code.

Change-Id: I487ffd391663cba47d2b26e8346cc7ac589dcd1a
Reviewed-on: https://go-review.googlesource.com/c/tools/+/184041
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Suzy Mueller <suzmue@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Rebecca Stambler 2019-06-27 13:28:40 -04:00
parent 1a55b1581c
commit 9947fec5c3

View File

@ -118,7 +118,8 @@ func (v *view) checkMetadata(ctx context.Context, f *goFile) (map[packageID]*met
return nil, pkg.Errors, fmt.Errorf("package %s has errors, skipping type-checking", pkg.PkgPath)
}
for importPath, importPkg := range pkg.Imports {
if len(importPkg.Errors) > 0 {
// If we encounter a package we cannot import, mark it as missing.
if importPkg.PkgPath != "unsafe" && len(importPkg.CompiledGoFiles) == 0 {
if f.missingImports == nil {
f.missingImports = make(map[packagePath]struct{})
}