func (e *FieldError) Error() string {

	if e.IsPlaceholderErr {

		buff := bytes.NewBufferString("")

		if e.IsSliceOrArray {

			for j, err := range e.SliceOrArrayErrs {
				buff.WriteString("\n")
				buff.WriteString(fmt.Sprintf(sliceErrMsg, e.Field, j, "\n"+err.Error()))
			}

		} else if e.IsMap {

			for key, err := range e.MapErrs {
				buff.WriteString(fmt.Sprintf(mapErrMsg, e.Field, key, "\n"+err.Error()))
			}
		}

		return strings.TrimSpace(buff.String())
	}

	return fmt.Sprintf(fieldErrMsg, e.Field, e.Tag)
}
func (e *FieldError) Error() string {

	if e.IsPlaceholderErr {

		buff := bytes.NewBufferString("")

		if e.IsSliceOrArray {

			for j, err := range e.SliceOrArrayErrs {
				buff.WriteString("\n")
				buff.WriteString(fmt.Sprintf(sliceErrMsg, e.Field, j, "\n"+err.Error()))
			}

		} else if e.IsMap {

			for key, err := range e.MapErrs {
				buff.WriteString(fmt.Sprintf(mapErrMsg, e.Field, key, "\n"+err.Error()))
			}
		}

		return strings.TrimSpace(buff.String())
	}

	return fmt.Sprintf(fieldErrMsg, e.Field, e.Tag)
}
func ( e * FieldError ) Error ( ) string { if e . IsPlaceholderErr { buff := bytes . NewBufferString ( " " ) if e . IsSliceOrArray { for j , err := range e . SliceOrArrayErrs { buff . WriteString ( " \n " ) buff . WriteString ( fmt . Sprintf ( sliceErrMsg , e . Field , j , " \n " + err . Error ( ) ) ) } } else if e . IsMap { for key , err := range e . MapErrs { buff . WriteString ( fmt . Sprintf ( mapErrMsg , e . Field , key , " \n " + err . Error ( ) ) ) } } return strings . TrimSpace ( buff . String ( ) ) } return fmt . Sprintf ( fieldErrMsg , e . Field , e . Tag ) }
// This is intended for use in development + debugging and not intended to be a production error message.
// it also allows FieldError to be used as an Error interface
This is intended for use in development + debugging and not intended to be a production error message . it also allows FieldError to be used as an Error interface