cmd/bundle: More idiomatic flag.Usage.

The responsibility of flag.Usage is to print usage to stderr:

> Usage prints to standard error a usage message documenting all
> defined command-line flags.

Calling os.Exit(2) is outside of its scope, flag package does that.

Change-Id: I3eef2b796e5ddedff6d5927dbcdbfff3a6082270
Reviewed-on: https://go-review.googlesource.com/23788
Reviewed-by: Joseph Holsten <joseph@josephholsten.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
This commit is contained in:
Dmitri Shuralyov 2016-06-06 04:27:18 -07:00 committed by Alan Donovan
parent 682b241254
commit 5b59ce8b5f
1 changed files with 1 additions and 1 deletions

View File

@ -129,7 +129,6 @@ func addImportMap(s string) {
func usage() { func usage() {
fmt.Fprintf(os.Stderr, "Usage: bundle [options] <src>\n") fmt.Fprintf(os.Stderr, "Usage: bundle [options] <src>\n")
flag.PrintDefaults() flag.PrintDefaults()
os.Exit(2)
} }
func main() { func main() {
@ -141,6 +140,7 @@ func main() {
args := flag.Args() args := flag.Args()
if len(args) != 1 { if len(args) != 1 {
usage() usage()
os.Exit(2)
} }
if *dstPath != "" { if *dstPath != "" {