Fix ValidationErrors.Error by remove fe lines

pull/709/head
xqbumu 4 years ago
parent e12b0631c3
commit 9c824907cf
  1. 5
      errors.go
  2. 1
      validator_test.go

@ -44,12 +44,9 @@ func (ve ValidationErrors) Error() string {
buff := bytes.NewBufferString("") buff := bytes.NewBufferString("")
var fe *fieldError
for i := 0; i < len(ve); i++ { for i := 0; i < len(ve); i++ {
fe = ve[i].(*fieldError) buff.WriteString(ve[i].Error())
buff.WriteString(fe.Error())
buff.WriteString("\n") buff.WriteString("\n")
} }

@ -8996,6 +8996,7 @@ func TestTranslationFieldErrors(t *testing.T) {
selfErr = append(selfErr, SelfError{e}) selfErr = append(selfErr, SelfError{e})
} }
NotEqual(t, selfErr.Error(), "")
Equal(t, selfErr.Translate(trans), ValidationErrorsTranslations{ Equal(t, selfErr.Translate(trans), ValidationErrorsTranslations{
"": " is a required field", "": " is a required field",
}) })

Loading…
Cancel
Save