Skip to content
This repository has been archived by the owner on Jul 12, 2023. It is now read-only.

Commit

Permalink
fix nit with multierror (#1124)
Browse files Browse the repository at this point in the history
* fix nit with errorornil

* consistency
  • Loading branch information
whaught authored Oct 29, 2020
1 parent d22c576 commit 7fe5a84
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
4 changes: 2 additions & 2 deletions internal/keyrotation/rotate.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func (s *Server) doRotate(ctx context.Context) error {
previousCreated = allowed[0].CreatedAt
}

var result error
var result *multierror.Error
deleted := 0
for _, key := range allowed {
if did, err := s.maybeDeleteKey(ctx, key, effectiveID, previousCreated); err != nil {
Expand All @@ -100,7 +100,7 @@ func (s *Server) doRotate(ctx context.Context) error {
logger.Infof("Deleted %d old revision keys.", deleted)
metricsMiddleware.RecordRevisionKeyDeletion(ctx, deleted)
}
return result
return result.ErrorOrNil()
}

func (s *Server) maybeDeleteKey(
Expand Down
6 changes: 1 addition & 5 deletions tools/export-analyzer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,7 @@ func checkExportFile(export *exportpb.TemporaryExposureKeyExport) error {
if err := checkKeys("revisedKeys", export.RevisedKeys, floor, ceiling); err != nil {
errors = multierror.Append(errors, err)
}

if errors != nil && len(errors.Errors) != 0 {
return errors
}
return nil
return errors.ErrorOrNil()
}

func checkKeys(kType string, keys []*exportpb.TemporaryExposureKey, floor, ceiling int32) error {
Expand Down

0 comments on commit 7fe5a84

Please sign in to comment.