Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
agnivade authored and robpike committed May 25, 2019
1 parent a3863fc commit d97bd5d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/cmd/doc/pkg.go
Expand Up @@ -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]
Expand Down

0 comments on commit d97bd5d

Please sign in to comment.