Fix go vet errors

This commit is contained in:
nemunaire 2022-07-08 23:11:11 +02:00
commit e84b1d67cb
8 changed files with 16 additions and 12 deletions

View file

@ -54,7 +54,7 @@ func getRawKey(input interface{}, validatorRe string, ordered bool, showLines bo
for i, v := range f {
if g, ok := v.(string); ok {
if strings.Index(g, separator) != -1 {
errs = append(errs, fmt.Errorf("flag items cannot contain %q character as it is used as separator. Change the separator attribute for this flag."))
errs = append(errs, fmt.Errorf("flag items cannot contain %q character as it is used as separator. Change the separator attribute for this flag.", separator))
return
} else {
fitems = append(fitems, g)
@ -308,7 +308,7 @@ func buildExerciceFlag(i Importer, exercice *fic.Exercice, flag ExerciceFlag, nl
if flag.Type == "label" {
addedFlag, berrs := buildLabelFlag(exercice, flag, nline+1)
for _, e := range berrs {
errs = append(errs, fmt.Errorf("%q: flag #%d: %w", path.Base(exercice.Path), nline+1), e)
errs = append(errs, fmt.Errorf("%q: flag #%d: %w", path.Base(exercice.Path), nline+1, e))
}
if addedFlag != nil {
ret = append(ret, importFlag{
@ -319,7 +319,7 @@ func buildExerciceFlag(i Importer, exercice *fic.Exercice, flag ExerciceFlag, nl
} else if flag.Type == "key" || strings.HasPrefix(flag.Type, "number") || flag.Type == "text" || flag.Type == "ucq" || flag.Type == "radio" || flag.Type == "vector" {
addedFlag, choices, berrs := buildKeyFlag(exercice, flag, nline+1, "Flag")
for _, e := range berrs {
errs = append(errs, fmt.Errorf("%q: flag #%d: %w", path.Base(exercice.Path), nline+1), e)
errs = append(errs, fmt.Errorf("%q: flag #%d: %w", path.Base(exercice.Path), nline+1, e))
}
if addedFlag != nil {
ret = append(ret, importFlag{