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

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

View file

@ -9,16 +9,16 @@ import (
var hooks = &CheckHooks{customHooks: map[string]CustomCheckHook{}}
type CheckFlagChoiceHook func(*fic.FlagChoice, *fic.Exercice, *CheckExceptions) []error
type CheckFlagKeyHook func(*fic.FlagKey, string, *fic.Exercice, *CheckExceptions) []error
type CheckFlagKeyWithChoicesHook func(*fic.FlagKey, string, []*fic.FlagChoice, *fic.Exercice, *CheckExceptions) []error
type CheckFlagLabelHook func(*fic.FlagLabel, *fic.Exercice, *CheckExceptions) []error
type CheckFlagMCQHook func(*fic.MCQ, []*fic.MCQ_entry, *fic.Exercice, *CheckExceptions) []error
type CheckFileHook func(*fic.EFile, *fic.Exercice, *CheckExceptions) []error
type CheckHintHook func(*fic.EHint, *fic.Exercice, *CheckExceptions) []error
type CheckMDTextHook func(string, string, *CheckExceptions, ...string) []error
type CheckExerciceHook func(*fic.Exercice, *CheckExceptions) []error
type CustomCheckHook func(interface{}, *CheckExceptions) []error
type CheckFlagChoiceHook func(*fic.FlagChoice, *fic.Exercice, *CheckExceptions) error
type CheckFlagKeyHook func(*fic.FlagKey, string, *fic.Exercice, *CheckExceptions) error
type CheckFlagKeyWithChoicesHook func(*fic.FlagKey, string, []*fic.FlagChoice, *fic.Exercice, *CheckExceptions) error
type CheckFlagLabelHook func(*fic.FlagLabel, *fic.Exercice, *CheckExceptions) error
type CheckFlagMCQHook func(*fic.MCQ, []*fic.MCQ_entry, *fic.Exercice, *CheckExceptions) error
type CheckFileHook func(*fic.EFile, *fic.Exercice, *CheckExceptions) error
type CheckHintHook func(*fic.EHint, *fic.Exercice, *CheckExceptions) error
type CheckMDTextHook func(string, string, *CheckExceptions, ...string) error
type CheckExerciceHook func(*fic.Exercice, *CheckExceptions) error
type CustomCheckHook func(interface{}, *CheckExceptions) error
type CheckHooks struct {
flagChoiceHooks []CheckFlagChoiceHook
@ -73,7 +73,7 @@ func (h *CheckHooks) RegisterCustomHook(hookname string, f CustomCheckHook) {
h.customHooks[hookname] = f
}
func (h *CheckHooks) CallCustomHook(hookname string, data interface{}, exceptions *CheckExceptions) []error {
func (h *CheckHooks) CallCustomHook(hookname string, data interface{}, exceptions *CheckExceptions) error {
if v, ok := h.customHooks[hookname]; ok {
return v(data, exceptions)
}