1
0
mirror of https://github.com/golang/go synced 2024-11-18 16:04:44 -07:00

internal/lsp: return error if there is no builtin package

When we stopped returning an error from awaitInitialized, we didn't
handle this case in LookupBuiltin.

Fixes golang/go#36975.

Change-Id: I9668a7148f60ca1f9cad953d46caf6ec5500541e
Reviewed-on: https://go-review.googlesource.com/c/tools/+/217399
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
This commit is contained in:
Rebecca Stambler 2020-02-02 18:10:18 -05:00
parent 90d7435838
commit 2de6fe5e3e

View File

@ -206,6 +206,9 @@ func (v *view) Rebuild(ctx context.Context) (source.Snapshot, error) {
func (v *view) LookupBuiltin(ctx context.Context, name string) (*ast.Object, error) {
v.awaitInitialized(ctx)
if v.builtin == nil {
return nil, errors.Errorf("no builtin package for view %s", v.name)
}
data := v.builtin.handle.Get(ctx)
if ctx.Err() != nil {
return nil, ctx.Err()