func (e *Errors) Reset() {
	e.errors = nil
}
Reset resets Errors instance to be empty
package errutil
import (
	"errors"
)
type Errors struct {
	capacity int
	errors   []error
}
func NewErrors(capacity ...int) *Errors {
	if len(capacity) == 0 {
		return &Errors{}
	}
	size := capacity[0]
	if size < 0 {
		size = 0
	}
	return &Errors{capacity: size}
}
func Chain(funcs ...func() error) error {
	var err error
	for _, fc := range funcs {
		err = fc()
		if err != nil {
			return err
		}
	}
	return err
}
func (e *Errors) Add(errs ...interface{}) *Errors {
	if errs == nil {
		return e
	}
	for _, err := range errs {
		switch v := err.(type) {
		case *Errors:
			if v != nil {
				e.errors = append(e.errors, v.errors...)
			}
		case Errors:
			e.errors = append(e.errors, v.errors...)
		case []error:
			e.errors = append(e.errors, v...)
		case []string:
			for _, s := range v {
				e.errors = append(e.errors, errors.New(s))
			}
		case error:
			e.errors = append(e.errors, v)
		case string:
			e.errors = append(e.errors, errors.New(v))
		}
	}
	if e.capacity > 0 && len(e.errors) > e.capacity {
		e.errors = e.errors[len(e.errors)-e.capacity:]
	}
	return e
}
func (e *Errors) Last() error {
	if e == nil || e.errors == nil {
		return nil
	}
	return e.errors[len(e.errors)-1]
}
func (e *Errors) All() []error {
	if e == nil || e.errors == nil {
		return nil
	}
	return e.errors
}
func (e *Errors) HasErrors() bool {
	if e == nil || e.errors == nil {
		return false
	}
	return len(e.errors) != 0
}
func (e *Errors) Num() int {
	if e == nil {
		return 0
	}
	return len(e.errors)
}
func (e *Errors) Cap() int {
	if e == nil {
		return 0
	}
	return e.capacity
}
func (e *Errors) Error() string {
	if e == nil || len(e.errors) == 0 {
		return ""
	}
	var result string
	for _, err := range e.errors {
		result += "  " + err.Error() + "\n"
	}
	return result
}