Skip to content

docs: document the flagsets.go/NewFlagSet wiring in the add-a-command recipes#79

Merged
andyrewlee merged 1 commit into
mainfrom
audit/32-document-flagsets-recipe
Jun 15, 2026
Merged

docs: document the flagsets.go/NewFlagSet wiring in the add-a-command recipes#79
andyrewlee merged 1 commit into
mainfrom
audit/32-document-flagsets-recipe

Conversation

@andyrewlee

Copy link
Copy Markdown
Owner

Both 'add a command' recipes predate flagsets.go + Command.NewFlagSet and stop
at 'add cmd/frob.go + a --json flag'. A contributor who follows the happy path
to add a flag-bearing command gets machine help that reports only --json and a
red make ci from TestCommandFlagsMatchExpected naming a file+table the recipe
never introduced. Add the three-step wiring (frobFlagSet in flagsets.go,
NewFlagSet in register, the expected-table entry), framed around keeping help in
sync -- Run parses the flags either way.


Part of a 38-PR stacked diff (audit/01audit/38), reviewed and merged bottom-up. This PR is based on audit/31-unknown-flag-pointer.

@andyrewlee andyrewlee force-pushed the audit/31-unknown-flag-pointer branch from 8fb3693 to 20e2539 Compare June 15, 2026 06:39
… recipes

Both 'add a command' recipes predate flagsets.go + Command.NewFlagSet and stop
at 'add cmd/frob.go + a --json flag'. A contributor who follows the happy path
to add a flag-bearing command gets machine help that reports only --json and a
red make ci from TestCommandFlagsMatchExpected naming a file+table the recipe
never introduced. Add the three-step wiring (frobFlagSet in flagsets.go,
NewFlagSet in register, the expected-table entry), framed around keeping help in
sync -- Run parses the flags either way.
@andyrewlee andyrewlee changed the base branch from audit/31-unknown-flag-pointer to main June 15, 2026 06:40
@andyrewlee andyrewlee force-pushed the audit/32-document-flagsets-recipe branch from 3445c78 to bb0df97 Compare June 15, 2026 06:40
@andyrewlee andyrewlee merged commit 6ba5ac8 into main Jun 15, 2026
4 checks passed
@andyrewlee andyrewlee deleted the audit/32-document-flagsets-recipe branch June 15, 2026 06:41
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