support parallel running of commands#2215
Merged
dearchap merged 7 commits intourfave:mainfrom Oct 28, 2025
Merged
Conversation
`go test -run 'TestCommand_ParallelRun' -count 100000 -failfast -race`
- defaultSliceFlagSeparator, disableSliceFlagSeparator, defaultMapFlagKeyValueSeparator converted to consts - command - new MapFlagKeyValueSeparator field
120fc33 to
5be0b1f
Compare
1 task
dearchap
reviewed
Oct 25, 2025
dearchap
reviewed
Oct 25, 2025
dearchap
reviewed
Oct 26, 2025
|
|
||
| func (cmd *Command) set(fName string, f Flag, val string) error { | ||
| cmd.setFlags[f] = struct{}{} | ||
| cmd.setMultiValueParsingConfig(f) |
Contributor
There was a problem hiding this comment.
strictly speaking this call should be moved into PreParse phase.
Contributor
Author
There was a problem hiding this comment.
Hi @dearchap
I tried to avoid breaking things, and there are two set methods set and Set
Initially I thought to call setMultiValueParsingConfig from inside parseFlags(args Args) (Args, error) { or run(... but found that Set can be called without Run , at least in tests , so I moved it where setMultiValueParsingConfig will be called for sure
dearchap
reviewed
Oct 26, 2025
dearchap
reviewed
Oct 26, 2025
dearchap
approved these changes
Oct 28, 2025
another-rex
pushed a commit
to google/osv-scanner
that referenced
this pull request
Nov 12, 2025
Thanks to urfave/cli#2215 we should no longer need this workaround 🎉
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What type of PR is this?
Fix to allow running commands in parallel (probably partial)
What this PR does / why we need it:
go test -run 'TestCommand_ParallelRun' -count 100000 -failfast -raceHelpFlagreuse in different commands by cloning flagVersionFlagreuse in different commandsdefaultSliceFlagSeparator,disableSliceFlagSeparator,defaultMapFlagKeyValueSeparatorconverted to constsMapFlagKeyValueSeparatorfieldSliceFlagSeparator,DisableSliceFlagSeparator,MapFlagKeyValueSeparatorare propagated down to FlagBase and then to (MapBase|SliceBase)Which issue(s) this PR fixes:
Fixes #2176
Special notes for your reviewer:
I just lurked around, so please recheck carefully
Testing
go test -run 'TestCommand_ParallelRun' -count 100000 -failfast -raceRelease Notes