1
0
mirror of https://github.com/golang/go synced 2024-11-20 08:04:42 -07:00

flag: simplify arg logic in parseOne

Fixes #21763.

Change-Id: I59ee4f24c8064df64d9ede11aac02bc7ce4995b3
Reviewed-on: https://go-review.googlesource.com/61491
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
alexpantyukhin 2017-09-05 15:48:56 +04:00 committed by Brad Fitzpatrick
parent 6675fadfb8
commit 2d362f7a49

View File

@ -839,7 +839,7 @@ func (f *FlagSet) parseOne() (bool, error) {
return false, nil
}
s := f.args[0]
if len(s) == 0 || s[0] != '-' || len(s) == 1 {
if len(s) < 2 || s[0] != '-' {
return false, nil
}
numMinuses := 1