godoc: choose a smaller-output example as help when there are unexpected arguments

Change CL 153869 added a help message when there are leftover arguments,
as that used to invoke the command-line interface that is now gone.
But the example in the help text (go doc -all net/http) generates a huge
amount of output.

Use a very simple, small-output example instead, to illustrate how to
solve the problem without scrolling the program description hundreds
of screenfuls away.

Change-Id: I1887af1f3e853bf3a852dc374746074f1cd39441
Reviewed-on: https://go-review.googlesource.com/c/155157
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
Rob Pike 2018-12-20 12:12:42 +11:00
parent 6e267b5cc7
commit 92cdcd90bf
1 changed files with 1 additions and 1 deletions

View File

@ -165,7 +165,7 @@ func main() {
// Check usage. // Check usage.
if flag.NArg() > 0 { 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".`) fmt.Fprintln(os.Stderr, `Unexpected arguments. Use "go doc" for command-line help output instead. For example, "go doc fmt.Printf".`)
usage() usage()
} }
if *httpAddr != "" && *urlFlag != "" && !*writeIndex { if *httpAddr != "" && *urlFlag != "" && !*writeIndex {