func Is(err error) func(error) bool {
	return func(err1 error) bool {
		return err == err1
	}
}
Is returns a function that returns whether the
an error is equal to the given error.
It is intended to be used as a "pass" argument
to Mask and friends; for example:

return errgo.Mask(err, errgo.Is(http.ErrNoCookie))

would return an error with an http.ErrNoCookie cause
only if that was err's diagnosis; otherwise the diagnosis
would be itself.
package errgo
import (
	"bytes"
	"fmt"
	"log"
	"runtime"
)
const debug = false
type Err struct {
	Message_ string
	Cause_ error
	Underlying_ error
	File string
	Line int
}
func (e *Err) Location() (file string, line int) {
	return e.File, e.Line
}
func (e *Err) Underlying() error {
	return e.Underlying_
}
func (e *Err) Cause() error {
	return e.Cause_
}
func (e *Err) Message() string {
	return e.Message_
}
func (e *Err) Error() string {
	switch {
	case e.Message_ == "" && e.Underlying_ == nil:
		return "<no error>"
	case e.Message_ == "":
		return e.Underlying_.Error()
	case e.Underlying_ == nil:
		return e.Message_
	}
	return fmt.Sprintf("%s: %v", e.Message_, e.Underlying_)
}
func (e *Err) GoString() string {
	return Details(e)
}
type Causer interface {
	Cause() error
}
type Wrapper interface {
	Message() string
	Underlying() error
}
type Locationer interface {
	Location() (file string, line int)
}
func Details(err error) string {
	if err == nil {
		return "[]"
	}
	var s []byte
	s = append(s, '[')
	for {
		s = append(s, '{')
		if err, ok := err.(Locationer); ok {
			file, line := err.Location()
			if file != "" {
				s = append(s, fmt.Sprintf("%s:%d", file, line)...)
				s = append(s, ": "...)
			}
		}
		if cerr, ok := err.(Wrapper); ok {
			s = append(s, cerr.Message()...)
			err = cerr.Underlying()
		} else {
			s = append(s, err.Error()...)
			err = nil
		}
		if debug {
			if err, ok := err.(Causer); ok {
				if cause := err.Cause(); cause != nil {
					s = append(s, fmt.Sprintf("=%T", cause)...)
					s = append(s, Details(cause)...)
				}
			}
		}
		s = append(s, '}')
		if err == nil {
			break
		}
		s = append(s, ' ')
	}
	s = append(s, ']')
	return string(s)
}
func (e *Err) SetLocation(callDepth int) {
	_, file, line, _ := runtime.Caller(callDepth + 1)
	e.File, e.Line = file, line
}
func setLocation(err error, callDepth int) {
	if e, _ := err.(*Err); e != nil {
		e.SetLocation(callDepth + 1)
	}
}
func New(s string) error {
	err := &Err{Message_: s}
	err.SetLocation(1)
	return err
}
func Newf(f string, a ...interface{}) error {
	err := &Err{Message_: fmt.Sprintf(f, a...)}
	err.SetLocation(1)
	return err
}
func match(err error, pass ...func(error) bool) bool {
	for _, f := range pass {
		if f(err) {
			return true
		}
	}
	return false
}