mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-04 12:07:09 +00:00
fix(corpus-sweep): name every missing required flag, in flag order
This commit is contained in:
1 parent
2fd67d42f9
commit
5892983ff8
2 files changed
+53
-7
No files matched your search
@@ -154,16 +154,28 @@ func parseArguments(arguments []string, stderr io.Writer) (config, error) {
|
||||
}
|
||||
configuration.extraArguments = flagSet.Args()
|
||||
|
||||
for name, value := range map[string]string{
|
||||
"--corpus": configuration.corpusRoot,
|
||||
"--spec": configuration.specPath,
|
||||
"--seeds": seedSpecification,
|
||||
"--output": configuration.outputDirectory,
|
||||
// Every missing flag is named together, in flag order: stopping at the
|
||||
// first turns one rerun into one rerun per missing flag.
|
||||
var missing []error
|
||||
for _, required := range []struct {
|
||||
name string
|
||||
value string
|
||||
}{
|
||||
{"--corpus", configuration.corpusRoot},
|
||||
{"--spec", configuration.specPath},
|
||||
{"--seeds", seedSpecification},
|
||||
{"--output", configuration.outputDirectory},
|
||||
} {
|
||||
if value == "" {
|
||||
return config{}, fmt.Errorf("%s is required", name)
|
||||
if required.value == "" {
|
||||
missing = append(
|
||||
missing,
|
||||
fmt.Errorf("%s is required", required.name),
|
||||
)
|
||||
}
|
||||
}
|
||||
if err := errors.Join(missing...); err != nil {
|
||||
return config{}, err
|
||||
}
|
||||
if configuration.maxSteps <= 0 {
|
||||
return config{}, fmt.Errorf(
|
||||
"--max-steps must be positive: every implementation needs the same step budget",
|
||||
|
||||
Reference in new issue
Block a user