Browse Source

etcdmain: print usage in stderr when flag.Parse fail

This fits the requirement of stderr.

I still let `etcd --version` and `etcd --help` print out to stdout
because when users ask explicitly for version/help docs, they expect to see
the doc in stdout.

Ref:
http://www.jstorimer.com/blogs/workingwithcode/7766119-when-to-use-stderr-instead-of-stdout
Yicheng Qin 10 years ago
parent
commit
7ba352d9ca
1 changed files with 1 additions and 1 deletions
  1. 1 1
      etcdmain/config.go

+ 1 - 1
etcdmain/config.go

@@ -146,7 +146,7 @@ func NewConfig() *config {
 	cfg.FlagSet = flag.NewFlagSet("etcd", flag.ContinueOnError)
 	fs := cfg.FlagSet
 	fs.Usage = func() {
-		fmt.Println(usageline)
+		fmt.Fprintln(os.Stderr, usageline)
 	}
 
 	// member