From c6bdef3fd83aa826abe14e8a63924365a286057f Mon Sep 17 00:00:00 2001 From: Rob Pike Date: Fri, 21 Oct 2011 11:16:46 -0700 Subject: [PATCH] gotest: make it easier to get the help string Because gotest's args are mingled with the tests, it's hard to get the usage message to print. This CL adds explicit support for -help, spelled several different ways. Gotest has special flags like -file that are somewhat hidden otherwise. R=golang-dev, rsc CC=golang-dev https://golang.org/cl/5298052 --- src/cmd/gotest/flag.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/cmd/gotest/flag.go b/src/cmd/gotest/flag.go index f8c2061ec68..0df9e24f133 100644 --- a/src/cmd/gotest/flag.go +++ b/src/cmd/gotest/flag.go @@ -107,6 +107,10 @@ func flag(i int) (f *flagSpec, value string, extra bool) { if strings.HasPrefix(arg, "--") { // reduce two minuses to one arg = arg[1:] } + switch arg { + case "-?", "-h", "-help": + usage() + } if arg == "" || arg[0] != '-' { return }