Use fmt.Errorf

This commit is contained in:
nemunaire 2020-04-15 07:39:38 +02:00
commit adb424ea03
11 changed files with 50 additions and 60 deletions

View file

@ -1,7 +1,6 @@
package sync
import (
"errors"
"fmt"
"math/rand"
"path"
@ -282,8 +281,8 @@ func buildExerciceFlag(i Importer, exercice fic.Exercice, flag ExerciceFlag, nli
}
ret = append(ret, importFlag{
Line: nline + 1,
Flag: addedFlag,
Line: nline + 1,
Flag: addedFlag,
})
}
return
@ -392,7 +391,6 @@ func ExerciceFlagsMap(i Importer, exercice fic.Exercice) (kmap map[int64]fic.Fla
return
}
// SyncExerciceFlags imports all kind of flags for the given challenge.
func SyncExerciceFlags(i Importer, exercice fic.Exercice) (kmap map[int64]fic.Flag, errs []string) {
if _, err := exercice.WipeFlags(); err != nil {
@ -456,12 +454,12 @@ func ApiGetRemoteExerciceFlags(ps httprouter.Params, _ []byte) (interface{}, err
if flags != nil {
return flags, nil
} else {
return flags, errors.New(fmt.Sprintf("%q", errs))
return flags, fmt.Errorf("%q", errs)
}
} else {
return exercice, errors.New(fmt.Sprintf("%q", errs))
return exercice, fmt.Errorf("%q", errs)
}
} else {
return nil, errors.New(fmt.Sprintf("%q", errs))
return nil, fmt.Errorf("%q", errs)
}
}