Skip to content

Parse empty shorthand flag values correctly - #541

Draft
sameerihs wants to merge 1 commit into
spf13:masterfrom
sameerihs:parse-empty-shorthand-values
Draft

sameerihs wants to merge 1 commit into
spf13:masterfrom
sameerihs:parse-empty-shorthand-values

Conversation

@sameerihs

Copy link
Copy Markdown

Treat = in -s= as the value separator even when the value is empty.
The current length check instead gives a string flag "="; optional-value
flags use their fallback and then fail on an unknown = shorthand.

Apply the same boundary correction to unknown shorthand handling so an
ignored -u= does not consume the next positional argument. Regressions cover
Parse, ParseAll, clusters, optional values, unknown flags and empty boolean
errors, with controls for non-empty values and a literal equals value.

Validation on Go 1.27.3/macOS arm64:

  • Eleven regression cases fail before the fix; all 19 cases pass afterward.
  • Full race suite, vet, build, repository-configured lint and formatting pass.
  • An additional 44 public-API review probes pass.
  • Linux/386 tests cross-compile; the binary was not executed locally.

Go 1.21.13 aborts before running tests on this Mac with
missing LC_UUID load command; pristine upstream fails identically. The
remaining Linux/Go-version CI matrix still needs to run.

This draft awaits confirmation of the contributor-agreement status.

@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.

2 participants