mirror of
https://github.com/golang/go
synced 2024-11-23 18:30:06 -07:00
cmd/doc: display a proper error when no packages are found
Fixes #32044 Change-Id: Ia220dbbe4d6851befe28dd2d4b8a1a7bc2757460 Reviewed-on: https://go-review.googlesource.com/c/go/+/178878 Run-TryBot: Agniva De Sarker <agniva.quicksilver@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Rob Pike <r@golang.org>
This commit is contained in:
parent
a3863fc18a
commit
d97bd5d07a
@ -129,7 +129,10 @@ func parsePackage(writer io.Writer, pkg *build.Package, userPath string) *Packag
|
||||
log.Fatal(err)
|
||||
}
|
||||
// Make sure they are all in one package.
|
||||
if len(pkgs) != 1 {
|
||||
if len(pkgs) == 0 {
|
||||
log.Fatalf("no source-code package in directory %s", pkg.Dir)
|
||||
}
|
||||
if len(pkgs) > 1 {
|
||||
log.Fatalf("multiple packages in directory %s", pkg.Dir)
|
||||
}
|
||||
astPkg := pkgs[pkg.Name]
|
||||
|
Loading…
Reference in New Issue
Block a user