-
Couldn't load subscription status.
- Fork 1.8k
support parallel running of commands #2215
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
`go test -run 'TestCommand_ParallelRun' -count 100000 -failfast -race`
- defaultSliceFlagSeparator, disableSliceFlagSeparator, defaultMapFlagKeyValueSeparator converted to consts - command - new MapFlagKeyValueSeparator field
120fc33 to
5be0b1f
Compare
|
|
||
| func (cmd *Command) set(fName string, f Flag, val string) error { | ||
| cmd.setFlags[f] = struct{}{} | ||
| cmd.setMultiValueParsingConfig(f) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
strictly speaking this call should be moved into PreParse phase.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
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