1
0
mirror of https://github.com/golang/go synced 2024-11-05 17:36:15 -07:00

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:
Yasuhiro Matsumoto 2019-02-21 09:26:10 +09:00 committed by Rebecca Stambler
parent a24c58a209
commit 9c8c5aeafa

View File

@ -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 {