internal/lsp: ignore errors when finding workspace modules
Fixes golang/go#41558
Change-Id: If00cdb310575ac195ce8ebce7f156e0daa192b8d
Reviewed-on: https://go-review.googlesource.com/c/tools/+/256578
Trust: Rebecca Stambler <rstambler@golang.org>
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
diff --git a/internal/lsp/cache/session.go b/internal/lsp/cache/session.go
index 2881738..6e31395 100644
--- a/internal/lsp/cache/session.go
+++ b/internal/lsp/cache/session.go
@@ -256,8 +256,9 @@
// Walk the view's folder to find all modules in the view.
modules := make(map[span.URI]*moduleRoot)
return modules, filepath.Walk(root.Filename(), func(path string, info os.FileInfo, err error) error {
+ // Ignore any errors we may encounter while visiting files.
if err != nil {
- return err
+ return filepath.SkipDir
}
// For any path that is not the workspace folder, check if the path
// would be ignored by the go command. Vendor directories also do not