diff options
| author | Fredrik Wallgren <[email protected]> | 2015-11-09 10:27:15 +0100 |
|---|---|---|
| committer | Fredrik Wallgren <[email protected]> | 2015-11-09 10:27:15 +0100 |
| commit | 935b2a1bd5710aede269d46752e59fba916abaea (patch) | |
| tree | e75c1831a0f73b71440f7e82c597dcc5cd22f177 /usage.go | |
| parent | 53364a0be4ce4b3a84cefd6fac452fb953cd5acf (diff) | |
Write usage message to stderr on error
When the parsing of parameters/flags fails eg. when a required flag is
missing, print the usage statement and error to stderr instead of
stdout.
Diffstat (limited to 'usage.go')
| -rw-r--r-- | usage.go | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -9,9 +9,9 @@ import ( "strings" ) -// Fail prints usage information to stdout and exits with non-zero status +// Fail prints usage information to stderr and exits with non-zero status func (p *Parser) Fail(msg string) { - p.WriteUsage(os.Stdout) + p.WriteUsage(os.Stderr) fmt.Println("error:", msg) os.Exit(-1) } |
