sync: Replace []error by go.uber.org/multierr

This commit is contained in:
nemunaire 2023-11-22 12:16:53 +01:00
commit b6966d47ce
25 changed files with 380 additions and 348 deletions

View file

@ -3,6 +3,8 @@ package main
import (
"fmt"
"go.uber.org/multierr"
"srs.epita.fr/fic-server/admin/sync"
"srs.epita.fr/fic-server/libfic"
)
@ -15,9 +17,9 @@ func RegisterChecksHooks(h *sync.CheckHooks) {
h.RegisterExerciceHook(CheckResolutionVideo)
}
func CheckResolutionVideo(e *fic.Exercice, exceptions *sync.CheckExceptions) (errs []error) {
for _, err := range checkResolutionVideo(e, exceptions) {
errs = append(errs, fmt.Errorf("resolution.mp4: %w", err))
func CheckResolutionVideo(e *fic.Exercice, exceptions *sync.CheckExceptions) (errs error) {
for _, err := range multierr.Errors(checkResolutionVideo(e, exceptions)) {
errs = multierr.Append(errs, fmt.Errorf("resolution.mp4: %w", err))
}
return