From 9c824907cf48a77cb904c3752312d150a4c5e0f0 Mon Sep 17 00:00:00 2001 From: xqbumu Date: Tue, 30 Mar 2021 16:36:28 +0800 Subject: [PATCH] Fix ValidationErrors.Error by remove fe lines --- errors.go | 5 +---- validator_test.go | 1 + 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/errors.go b/errors.go index 6d80433..17d3769 100644 --- a/errors.go +++ b/errors.go @@ -44,12 +44,9 @@ func (ve ValidationErrors) Error() string { buff := bytes.NewBufferString("") - var fe *fieldError - for i := 0; i < len(ve); i++ { - fe = ve[i].(*fieldError) - buff.WriteString(fe.Error()) + buff.WriteString(ve[i].Error()) buff.WriteString("\n") } diff --git a/validator_test.go b/validator_test.go index be1bd0a..119b7ac 100644 --- a/validator_test.go +++ b/validator_test.go @@ -8996,6 +8996,7 @@ func TestTranslationFieldErrors(t *testing.T) { selfErr = append(selfErr, SelfError{e}) } + NotEqual(t, selfErr.Error(), "") Equal(t, selfErr.Translate(trans), ValidationErrorsTranslations{ "": " is a required field", })