Commit 22505cd2 authored by Russ Cox's avatar Russ Cox

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
parent c8ef6776
......@@ -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 {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment