1
0
mirror of https://github.com/golang/go synced 2024-09-30 16:28:32 -06:00

cmd/godoc: print a helpful error if used for command-line docs

The command-line interface was recently removed in favor of "go doc".

Change-Id: Idfcfca3b2eafaf63148a2ed88d4d25c61d9e3c69
Reviewed-on: https://go-review.googlesource.com/c/153869
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Filippo Valsorda 2018-12-12 19:26:57 -05:00
parent d4971274fe
commit 88e3b261f2

View File

@ -163,15 +163,13 @@ func main() {
playEnabled = *showPlayground
// Check usage: server and no args.
if (*httpAddr != "" || *urlFlag != "") && (flag.NArg() > 0) {
fmt.Fprintln(os.Stderr, "Unexpected arguments.")
// Check usage.
if flag.NArg() > 0 {
fmt.Fprintln(os.Stderr, `Unexpected arguments. Use "go doc" for command-line help output instead. For example, "go doc -all net/http".`)
usage()
}
// Check usage: command line args or index creation mode.
if (*httpAddr != "" || *urlFlag != "") != (flag.NArg() == 0) && !*writeIndex {
fmt.Fprintln(os.Stderr, "missing args.")
if *httpAddr != "" && *urlFlag != "" && !*writeIndex {
fmt.Fprintln(os.Stderr, "Missing args.")
usage()
}