Skip to content

fix: reset ArgsLenAtDash on repeated parses - #539

Open
gyanu2507 wants to merge 1 commit into
spf13:masterfrom
gyanu2507:fix/538-reset-args-len-at-dash
Open

gyanu2507 wants to merge 1 commit into
spf13:masterfrom
gyanu2507:fix/538-reset-args-len-at-dash

Conversation

@gyanu2507

Copy link
Copy Markdown

Parse and ParseAll now reset the stored -- position before each argument list, so reusing a FlagSet cannot return a stale ArgsLenAtDash() value. Regression coverage exercises a first parse with --, followed by parses without it and with no arguments, and covers both parsing entry points.

Tests: go test -race ./...; golangci-lint run ./...

Fixes #538

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ArgsLenAtDash retains the previous delimiter position when a FlagSet is parsed again

2 participants