internal/lsp: clear out missing imports set when we re-load package
This change ensures that we always populate a new set of missing imports when we re-load a package. Otherwise, we might keep stale missing imports around. Change-Id: Id9b6b8201e3ed093a7b9ece97a81e298de612a5e Reviewed-on: https://go-review.googlesource.com/c/tools/+/182459 Run-TryBot: Rebecca Stambler <rstambler@golang.org> Reviewed-by: Ian Cottrell <iancottrell@google.com>
This commit is contained in:
parent
1edc8e83c8
commit
d1d6cdd8a6
|
@ -145,12 +145,11 @@ func (v *view) link(ctx context.Context, pkgPath packagePath, pkg *packages.Pack
|
||||||
// If we haven't seen this package before.
|
// If we haven't seen this package before.
|
||||||
if !ok {
|
if !ok {
|
||||||
m = &metadata{
|
m = &metadata{
|
||||||
pkgPath: pkgPath,
|
pkgPath: pkgPath,
|
||||||
id: id,
|
id: id,
|
||||||
typesSizes: pkg.TypesSizes,
|
typesSizes: pkg.TypesSizes,
|
||||||
parents: make(map[packageID]bool),
|
parents: make(map[packageID]bool),
|
||||||
children: make(map[packageID]bool),
|
children: make(map[packageID]bool),
|
||||||
missingImports: make(map[packagePath]struct{}),
|
|
||||||
}
|
}
|
||||||
v.mcache.packages[id] = m
|
v.mcache.packages[id] = m
|
||||||
v.mcache.ids[pkgPath] = id
|
v.mcache.ids[pkgPath] = id
|
||||||
|
@ -172,6 +171,7 @@ func (v *view) link(ctx context.Context, pkgPath packagePath, pkg *packages.Pack
|
||||||
m.parents[parent.id] = true
|
m.parents[parent.id] = true
|
||||||
parent.children[id] = true
|
parent.children[id] = true
|
||||||
}
|
}
|
||||||
|
m.missingImports = make(map[packagePath]struct{})
|
||||||
for importPath, importPkg := range pkg.Imports {
|
for importPath, importPkg := range pkg.Imports {
|
||||||
if len(importPkg.Errors) > 0 {
|
if len(importPkg.Errors) > 0 {
|
||||||
m.missingImports[pkgPath] = struct{}{}
|
m.missingImports[pkgPath] = struct{}{}
|
||||||
|
|
Loading…
Reference in New Issue