From 1ef76e824fa82086d10552de1c51ef5fbb4ad129 Mon Sep 17 00:00:00 2001 From: Artem Bortnikov <26360954+BROngineer@users.noreply.github.com> Date: Sun, 16 Jun 2024 01:30:35 +0300 Subject: [PATCH] fix infinite loop while parsing in case first arg is not a flag (#3) --- flagset.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/flagset.go b/flagset.go index d8aecbc..240ed6e 100644 --- a/flagset.go +++ b/flagset.go @@ -51,6 +51,8 @@ func (fs *FlagSet) Parse(args []string) error { i, err = fs.parseLong(args, i) case strings.HasPrefix(args[i], shortFlagNamePrefix): i, err = fs.parseShort(args, i) + default: + i++ } if err != nil { return err