From: Russ Cox Date: Wed, 16 Apr 2014 00:05:56 +0000 (-0400) Subject: cmd/pack: print error along with usage X-Git-Tag: go1.3beta1~71 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=22505cd2a1f6006c50a90999561463eba57897de;p=gostls13.git cmd/pack: print error along with usage My cmd/go got in a weird state where it started invoking pack grcP. Change pack to print a 1-line explanation of the usage problem before the generic usage message. LGTM=r R=r CC=golang-codereviews https://golang.org/cl/87770047 --- diff --git a/src/cmd/pack/pack.go b/src/cmd/pack/pack.go index ce73164171..468104deb6 100644 --- a/src/cmd/pack/pack.go +++ b/src/cmd/pack/pack.go @@ -52,6 +52,8 @@ func main() { log.SetPrefix("pack: ") // need "pack op archive" at least. if len(os.Args) < 3 { + log.Print("not enough arguments") + fmt.Fprintln(os.Stderr) usage() } setOp(os.Args[1]) @@ -75,6 +77,8 @@ func main() { ar = archive(os.Args[2], os.O_RDONLY, os.Args[3:]) ar.scan(ar.extractContents) default: + log.Printf("invalid operation %q", os.Args[1]) + fmt.Fprintln(os.Stderr) usage() } if len(ar.files) > 0 {