Print out usage message to STDERR

`flag.PrintDefaults()` writes to `os.Stderr`, therefore the "Usage"
part should go there as well.
This commit is contained in:
Andrew Slotin 2017-10-13 19:01:54 +07:00
parent 4ab47545f7
commit d506dad041

View File

@ -30,7 +30,7 @@ var args struct {
func init() {
flag.DurationVar(&args.DBOpenTimeout, "timeout", DefaultDBOpenTimeout, "DB file open timeout")
flag.Usage = func() {
fmt.Fprintf(os.Stdout, "Usage: %s [OPTIONS] <filename(s)>\nOptions:\n", ProgramName)
fmt.Fprintf(os.Stderr, "Usage: %s [OPTIONS] <filename(s)>\nOptions:\n", ProgramName)
flag.PrintDefaults()
}
}