mirror of
https://github.com/golang/go
synced 2024-11-18 21:14:44 -07:00
internal/lsp: add additional check for analysis value
Updates golang/go#35339 Change-Id: Ie990672b619d1844f66abf62010fe9a69daf00d9 Reviewed-on: https://go-review.googlesource.com/c/tools/+/205161 Run-TryBot: Rebecca Stambler <rstambler@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Cottrell <iancottrell@google.com>
This commit is contained in:
parent
b1cdfd15c4
commit
dc038396d1
13
internal/lsp/cache/analysis.go
vendored
13
internal/lsp/cache/analysis.go
vendored
@ -131,8 +131,7 @@ func (s *snapshot) actionHandle(ctx context.Context, id packageID, mode source.P
|
|||||||
err: err,
|
err: err,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
data := runAnalysis(ctx, fset, a, pkg, results)
|
return runAnalysis(ctx, fset, a, pkg, results)
|
||||||
return data
|
|
||||||
})
|
})
|
||||||
ah.handle = h
|
ah.handle = h
|
||||||
|
|
||||||
@ -145,7 +144,10 @@ func (act *actionHandle) analyze(ctx context.Context) ([]*source.Error, interfac
|
|||||||
if v == nil {
|
if v == nil {
|
||||||
return nil, nil, errors.Errorf("no analyses for %s", act.pkg.ID())
|
return nil, nil, errors.Errorf("no analyses for %s", act.pkg.ID())
|
||||||
}
|
}
|
||||||
data := v.(*actionData)
|
data, ok := v.(*actionData)
|
||||||
|
if !ok {
|
||||||
|
return nil, nil, errors.Errorf("unexpected type for %s:%s", act.pkg.ID(), act.analyzer.Name)
|
||||||
|
}
|
||||||
return data.diagnostics, data.result, data.err
|
return data.diagnostics, data.result, data.err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,7 +156,10 @@ func (act *actionHandle) cached() ([]*source.Error, interface{}, error) {
|
|||||||
if v == nil {
|
if v == nil {
|
||||||
return nil, nil, errors.Errorf("no analyses for %s", act.pkg.ID())
|
return nil, nil, errors.Errorf("no analyses for %s", act.pkg.ID())
|
||||||
}
|
}
|
||||||
data := v.(*actionData)
|
data, ok := v.(*actionData)
|
||||||
|
if !ok {
|
||||||
|
return nil, nil, errors.Errorf("unexpected type for %s:%s", act.pkg.ID(), act.analyzer.Name)
|
||||||
|
}
|
||||||
return data.diagnostics, data.result, data.err
|
return data.diagnostics, data.result, data.err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user