fix(policy/checker): more explicit short-circuit

Signed-off-by: Xe Iaso <me@xeiaso.net>
This commit is contained in:
Xe Iaso
2025-10-25 01:19:35 +00:00
parent b291170cb6
commit 5a8df9d688

View File

@@ -20,8 +20,6 @@ type List []Impl
// It returns true only if *all* checkers return true (AND semantics).
// If any checker returns an error, the function returns false and the error.
func (l List) Check(r *http.Request) (bool, error) {
// Assume success until a checker says otherwise.
allOk := true
for _, c := range l {
ok, err := c.Check(r)
if err != nil {
@@ -31,11 +29,11 @@ func (l List) Check(r *http.Request) (bool, error) {
if !ok {
// One false means the combined result is false. Short-circuit
// so we don't waste time.
allOk = false
break
return false, err
}
}
return allOk, nil
// Assume success until a checker says otherwise.
return true, nil
}
func (l List) Hash() string {