func Equals(e error) Matcher {
	return &equals{e}
}
Equals returns a Matcher to check if an error equals the given error.
package stackerr
import (
	"errors"
	"fmt"
	"github.com/facebookgo/stack"
)
type Error struct {
	multiStack *stack.Multi
	underlying error
}
func (e *Error) Error() string {
	return fmt.Sprintf("%s\n%s", e.underlying, e.multiStack)
}
func (e *Error) MultiStack() *stack.Multi {
	return e.multiStack
}
func (e *Error) Underlying() error {
	return e.underlying
}
type hasMultiStack interface {
	MultiStack() *stack.Multi
}
func WrapSkip(err error, skip int) error {
	if err == nil {
		return nil
	}
	if se, ok := err.(hasMultiStack); ok {
		se.MultiStack().AddCallers(skip + 1)
		return err
	}
	return &Error{
		multiStack: stack.CallersMulti(skip + 1),
		underlying: err,
	}
}
func Wrap(err error) error {
	return WrapSkip(err, 1)
}
func New(s string) error {
	return WrapSkip(errors.New(s), 1)
}
func Newf(format string, args ...interface{}) error {
	return WrapSkip(fmt.Errorf(format, args...), 1)
}
type hasUnderlying interface {
	Underlying() error
}
func Underlying(e error) []error {
	if e == nil {
		return nil
	}
	var errs []error
	for {
		if e == nil {
			return errs
		}
		errs = append(errs, e)
		if eh, ok := e.(hasUnderlying); ok {
			e = eh.Underlying()
		} else {
			e = nil
		}
	}
}
type Matcher interface {
	Match(e error) bool
}
type equals struct {
	error error
}
func (e *equals) Match(other error) bool {
	return e.error == other
}