mirror of https://github.com/golang/go.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
This commit is contained in:
parent
c8ef6776e4
commit
22505cd2a1
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Reference in New Issue