From 11b7cf8387a31f278486eaad758162830eca8c73 Mon Sep 17 00:00:00 2001 From: Brendan Burns Date: Wed, 11 Mar 2015 11:10:28 -0700 Subject: Always return when err is not nil. --- bool_test.go | 2 +- example_test.go | 2 +- flag.go | 4 ++++ 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 } -- cgit v1.2.3