Commit 0509bac
authored
Fail immediately if there's a getopt parse error (#30)
The getopt code doesn't appear to fully respect ErrorHandling so
unrecognized flags result in Usage being displayed but not an Exit().
https://github.com/rsc/getopt/blob/20be20937449f18bb9967c10d732849fb4401e63/getopt.go#L274-L277
In our application, this was causing Usage to be displayed twice.
To fix this, we catch the lower-level Parse() error and bail
immediately.1 parent dae9dc7 commit 0509bac
1 file changed
+3
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
130 | | - | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
131 | 133 | | |
132 | 134 | | |
133 | 135 | | |
| |||
0 commit comments