From a2c791aa643c06723cbbec1cbba98909a95253ba Mon Sep 17 00:00:00 2001 From: Yasuhiro Matsumoto Date: Tue, 8 Jan 2019 12:56:24 +0900 Subject: [PATCH] internal/lsp/cache: return error when no packages found Change-Id: Ia11f0c428cffdd42eab5c4322e9ff6f0a38870fc Reviewed-on: https://go-review.googlesource.com/c/156777 Reviewed-by: Rebecca Stambler Run-TryBot: Rebecca Stambler TryBot-Result: Gobot Gobot --- internal/lsp/cache/view.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/lsp/cache/view.go b/internal/lsp/cache/view.go index 812fa1daaf5..aff5988c4d1 100644 --- a/internal/lsp/cache/view.go +++ b/internal/lsp/cache/view.go @@ -104,7 +104,11 @@ func (v *View) parse(uri source.URI) error { } return err } + for _, pkg := range pkgs { + if len(pkg.Syntax) == 0 { + return fmt.Errorf("no syntax trees for %s", pkg.PkgPath) + } // Add every file in this package to our cache. for _, fAST := range pkg.Syntax { // TODO: If a file is in multiple packages, which package do we store?