Prefer early return
This commit is contained in:
parent
8d8e1f3abd
commit
10c3e482b4
@ -1,4 +1,4 @@
|
|||||||
// Copyright 2021 the Pinniped contributors. All Rights Reserved.
|
// Copyright 2021-2023 the Pinniped contributors. All Rights Reserved.
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
package issuer
|
package issuer
|
||||||
@ -42,12 +42,11 @@ func (c ClientCertIssuers) IssueClientCertPEM(username string, groups []string,
|
|||||||
|
|
||||||
for _, issuer := range c {
|
for _, issuer := range c {
|
||||||
certPEM, keyPEM, err := issuer.IssueClientCertPEM(username, groups, ttl)
|
certPEM, keyPEM, err := issuer.IssueClientCertPEM(username, groups, ttl)
|
||||||
if err != nil {
|
if err == nil {
|
||||||
errs = append(errs, fmt.Errorf("%s failed to issue client cert: %w", issuer.Name(), err))
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
return certPEM, keyPEM, nil
|
return certPEM, keyPEM, nil
|
||||||
}
|
}
|
||||||
|
errs = append(errs, fmt.Errorf("%s failed to issue client cert: %w", issuer.Name(), err))
|
||||||
|
}
|
||||||
|
|
||||||
if err := errors.NewAggregate(errs); err != nil {
|
if err := errors.NewAggregate(errs); err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
|
Loading…
Reference in New Issue
Block a user