repochecker: Fix number of detected choices with step attribute
This commit is contained in:
parent
08107931ea
commit
f328261ea2
@ -286,7 +286,6 @@ func iface2Number(input interface{}, output *string) error {
|
|||||||
*output = fmt.Sprintf("%d", v)
|
*output = fmt.Sprintf("%d", v)
|
||||||
} else if v, ok := input.(float64); ok {
|
} else if v, ok := input.(float64); ok {
|
||||||
*output = strconv.FormatFloat(v, 'f', -1, 64)
|
*output = strconv.FormatFloat(v, 'f', -1, 64)
|
||||||
fmt.Printf("%s\n", *output)
|
|
||||||
} else {
|
} else {
|
||||||
return fmt.Errorf("has an invalid type: expected int or float, got %T", input)
|
return fmt.Errorf("has an invalid type: expected int or float, got %T", input)
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ func EPITACheckKeyFlag(flag *fic.FlagKey, raw string, _ *fic.Exercice, exception
|
|||||||
errs = append(errs, err)
|
errs = append(errs, err)
|
||||||
} else if min == nil || max == nil || step == nil {
|
} else if min == nil || max == nil || step == nil {
|
||||||
errs = append(errs, fmt.Errorf("please define min and max for your number flag"))
|
errs = append(errs, fmt.Errorf("please define min and max for your number flag"))
|
||||||
} else if (*max-*min)**step <= 10 {
|
} else if (*max-*min) / *step <= 10 {
|
||||||
errs = append(errs, fmt.Errorf("to avoid bruteforce, define more than 10 possibilities"))
|
errs = append(errs, fmt.Errorf("to avoid bruteforce, define more than 10 possibilities"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user