mirror of
https://github.com/golang/go
synced 2024-11-22 07:54:40 -07:00
- exit godoc w/o crashing if negative tabwidth is provided
- minor related cleanups R=rsc http://go/go-review/1025026
This commit is contained in:
parent
8b04ceff62
commit
aae64f8c81
@ -143,16 +143,13 @@ func main() {
|
|||||||
flag.Usage = usage;
|
flag.Usage = usage;
|
||||||
flag.Parse();
|
flag.Parse();
|
||||||
|
|
||||||
// Check usage first; get usage message out early.
|
// Check usage: either server and no args, or command line and args
|
||||||
switch {
|
if (*httpaddr != "") != (flag.NArg() == 0) {
|
||||||
case *httpaddr != "":
|
usage();
|
||||||
if flag.NArg() != 0 {
|
}
|
||||||
usage();
|
|
||||||
}
|
if *tabwidth < 0 {
|
||||||
default:
|
log.Exitf("negative tabwidth %d", *tabwidth);
|
||||||
if flag.NArg() == 0 {
|
|
||||||
usage();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := os.Chdir(goroot); err != nil {
|
if err := os.Chdir(goroot); err != nil {
|
||||||
@ -168,8 +165,10 @@ func main() {
|
|||||||
log.Stderrf("Go Documentation Server\n");
|
log.Stderrf("Go Documentation Server\n");
|
||||||
log.Stderrf("address = %s\n", *httpaddr);
|
log.Stderrf("address = %s\n", *httpaddr);
|
||||||
log.Stderrf("goroot = %s\n", goroot);
|
log.Stderrf("goroot = %s\n", goroot);
|
||||||
|
log.Stderrf("cmdroot = %s\n", *cmdroot);
|
||||||
log.Stderrf("pkgroot = %s\n", *pkgroot);
|
log.Stderrf("pkgroot = %s\n", *pkgroot);
|
||||||
log.Stderrf("tmplroot = %s\n", *tmplroot);
|
log.Stderrf("tmplroot = %s\n", *tmplroot);
|
||||||
|
log.Stderrf("tabwidth = %d\n", *tabwidth);
|
||||||
handler = loggingHandler(handler);
|
handler = loggingHandler(handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user