1
0
mirror of https://github.com/golang/go synced 2024-11-05 14:56:10 -07: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 playEnabled = *showPlayground
// Check usage: server and no args. // Check usage.
if (*httpAddr != "" || *urlFlag != "") && (flag.NArg() > 0) { if flag.NArg() > 0 {
fmt.Fprintln(os.Stderr, "Unexpected arguments.") fmt.Fprintln(os.Stderr, `Unexpected arguments. Use "go doc" for command-line help output instead. For example, "go doc -all net/http".`)
usage() usage()
} }
if *httpAddr != "" && *urlFlag != "" && !*writeIndex {
// Check usage: command line args or index creation mode. fmt.Fprintln(os.Stderr, "Missing args.")
if (*httpAddr != "" || *urlFlag != "") != (flag.NArg() == 0) && !*writeIndex {
fmt.Fprintln(os.Stderr, "missing args.")
usage() usage()
} }