mirror of
https://github.com/golang/go
synced 2024-11-18 16:44:43 -07:00
go/packages: handle potential nil pointer error
Change-Id: I2b889e1d5ec07d9271292c58b896f6c0c7155cf3 Reviewed-on: https://go-review.googlesource.com/c/tools/+/179220 Run-TryBot: Rebecca Stambler <rstambler@golang.org> Run-TryBot: Michael Matloob <matloob@golang.org> Reviewed-by: Michael Matloob <matloob@golang.org>
This commit is contained in:
parent
d5577298ec
commit
f98590f1bf
@ -172,7 +172,19 @@ extractQueries:
|
||||
// Check candidate packages for containFiles.
|
||||
if len(containFiles) > 0 {
|
||||
for _, id := range containsCandidates {
|
||||
pkg := response.seenPackages[id]
|
||||
pkg, ok := response.seenPackages[id]
|
||||
if !ok {
|
||||
response.addPackage(&Package{
|
||||
ID: id,
|
||||
Errors: []Error{
|
||||
{
|
||||
Kind: ListError,
|
||||
Msg: fmt.Sprintf("package %s expected but not seen", id),
|
||||
},
|
||||
},
|
||||
})
|
||||
continue
|
||||
}
|
||||
for _, f := range containFiles {
|
||||
for _, g := range pkg.GoFiles {
|
||||
if sameFile(f, g) {
|
||||
|
Loading…
Reference in New Issue
Block a user