Skip to content

Validate positional order across argument structs - #314

Open
Boulea7 wants to merge 1 commit into
alexflint:masterfrom
Boulea7:fix/positional-order-across-destinations
Open

Boulea7 wants to merge 1 commit into
alexflint:masterfrom
Boulea7:fix/positional-order-across-destinations

Conversation

@Boulea7

@Boulea7 Boulea7 commented Dec 3, 2026

Copy link
Copy Markdown

NewParser combines all destination structs into one command. With a positional slice in one struct and another positional in a later struct, the generated usage lists both positions. The slice consumes all remaining tokens, so the later field is unreachable.

Apply the same positional-order check across the top-level destinations. Each subcommand checks its own positional order.

The regression tests cover slice-to-slice and map-to-scalar declarations, a scalar followed by a trailing slice, and independent sibling subcommands. Tested on Go 1.18, 1.25.8, 1.26.11, and Go 1.27.4 with -race.

Follow-up to #265 and #287.

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.

1 participant