aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrendan Burns <[email protected]>2015-03-11 11:10:28 -0700
committerspf13 <[email protected]>2015-03-12 22:17:30 -0400
commit11b7cf8387a31f278486eaad758162830eca8c73 (patch)
tree1e6ed20e3a409603d621ce994e615f90cb3d58bc
parent370c3171201099fa6b466db45c8a032cbce33d8d (diff)
Always return when err is not nil.
-rw-r--r--bool_test.go2
-rw-r--r--example_test.go2
-rw-r--r--flag.go4
3 files changed, 6 insertions, 2 deletions
diff --git a/bool_test.go b/bool_test.go
index 72a12be..fe45b8d 100644
--- a/bool_test.go
+++ b/bool_test.go
@@ -9,7 +9,7 @@ import (
"strconv"
"testing"
- . "github.com/ogier/pflag"
+ . "github.com/spf13/pflag"
)
// This value can be a boolean ("true", "false") or "maybe"
diff --git a/example_test.go b/example_test.go
index 6aaed3c..9be7a49 100644
--- a/example_test.go
+++ b/example_test.go
@@ -11,7 +11,7 @@ import (
"strings"
"time"
- flag "github.com/ogier/pflag"
+ flag "github.com/spf13/pflag"
)
// Example 1: A single string flag called "species" with default value "gopher".
diff --git a/flag.go b/flag.go
index ad65dda..72165f6 100644
--- a/flag.go
+++ b/flag.go
@@ -498,6 +498,7 @@ func (f *FlagSet) parseShortArg(s string, args []string) (a []string, err error)
if len(args) == 0 {
return
}
+ return
}
if alreadythere {
if bv, ok := flag.Value.(boolFlag); ok && bv.IsBoolFlag() {
@@ -551,6 +552,9 @@ func (f *FlagSet) parseArgs(args []string) (err error) {
} else {
args, err = f.parseShortArg(s, args)
}
+ if err != nil {
+ return
+ }
}
return
}