internal/lsp/cache: skip duplicate import of packages
Change-Id: I33e06b53269cef7aa8962dd41ea74ce25e82fc54 Reviewed-on: https://go-review.googlesource.com/c/163257 Reviewed-by: Rebecca Stambler <rstambler@golang.org> Run-TryBot: Rebecca Stambler <rstambler@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
a24c58a209
commit
9c8c5aeafa
|
@ -197,6 +197,9 @@ type entry struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (imp *importer) addImports(path string, pkg *packages.Package) error {
|
func (imp *importer) addImports(path string, pkg *packages.Package) error {
|
||||||
|
if _, ok := imp.packages[path]; ok {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
imp.packages[path] = pkg
|
imp.packages[path] = pkg
|
||||||
for importPath, importPkg := range pkg.Imports {
|
for importPath, importPkg := range pkg.Imports {
|
||||||
if err := imp.addImports(importPath, importPkg); err != nil {
|
if err := imp.addImports(importPath, importPkg); err != nil {
|
||||||
|
|
Loading…
Reference in New Issue