-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug in v3: Count is off by 1 #1930
Comments
I doubt it :( I THINK the issue might be due to these two lines: Line 169 in c4cd0a5
and Line 66 in c4cd0a5
But I'm not so deep in understanding the source that I can tell for sure. I'm also wondering: It seems, ALL flags are counted. Why is |
No one has requested count for non-bool flags. Not sure when I can get around to a fix though. |
That "fix" (if it is a fix) should be easy. Just get rid of "if Countable" in the Count function. |
@Skeeve Would you like to submit a PR with the change ? I'll get glad to review it. |
I would like to, but I can't. I have the slight feeling there is more wrong to it, than I first thought. Here are my observations.
I created a test command for counting bools. I also thought about counting all flags. I think it only makes sense for the |
Checklist
What problem did you observe?
When using cmd.Count("verbose") on my bool flag, it's value is always one too high
Test Program
Also on playground: https://play.golang.com/p/om6L1TD_6s5
The text was updated successfully, but these errors were encountered: