mirror of
https://github.com/golang/go
synced 2024-11-18 11:44:45 -07:00
cmd/godoc: add better user error messages
Fixes golang/go#14280 Change-Id: I3151a17ce9553d0a7fe56c2d614e3a6f6a96344c Reviewed-on: https://go-review.googlesource.com/36472 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
bd1cf89d8f
commit
f5bb18ad35
@ -162,8 +162,15 @@ func main() {
|
||||
|
||||
playEnabled = *showPlayground
|
||||
|
||||
// Check usage: either server and no args, command line and args, or index creation mode
|
||||
// Check usage: server and no args.
|
||||
if (*httpAddr != "" || *urlFlag != "") && (flag.NArg() > 0) {
|
||||
fmt.Fprintln(os.Stderr, "can't use -http with args.")
|
||||
usage()
|
||||
}
|
||||
|
||||
// Check usage: command line args or index creation mode.
|
||||
if (*httpAddr != "" || *urlFlag != "") != (flag.NArg() == 0) && !*writeIndex {
|
||||
fmt.Fprintln(os.Stderr, "missing args.")
|
||||
usage()
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user