func MaskFunc(allow ...func(error) bool) func(error, ...func(error) bool) error {
	return func(err error, allow1 ...func(error) bool) error {
		var allowEither []func(error) bool
		if len(allow1) > 0 {
			allowEither = make([]func(error) bool, len(allow)+len(allow1))
			copy(allowEither, allow)
			copy(allowEither[len(allow):], allow1)
		} else {
			allowEither = allow
		}
		err = Mask(err, allowEither...)
		setLocation(err, 1)
		return err
	}
}
MaskFunc returns an equivalent of Mask that always allows the
specified causes in addition to any causes specified when the
returned function is called.

It is defined for convenience, for example when all calls to Mask in
a given package wish to allow the same set of causes to be returned.
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
}
func Is(err error) func(error) bool {
	return func(err1 error) bool {
		return err == err1
	}
}
func Any(error) bool {
	return true
}
func NoteMask(underlying error, msg string, pass ...func(error) bool) error {
	err := noteMask(underlying, msg, pass...)
	setLocation(err, 1)
	return err
}
func noteMask(underlying error, msg string, pass ...func(error) bool) error {
	newErr := &Err{
		Underlying_: underlying,
		Message_:    msg,
	}
	if len(pass) > 0 {
		if cause := Cause(underlying); match(cause, pass...) {
			newErr.Cause_ = cause
		}
	}
	if debug {
		if newd, oldd := newErr.Cause_, Cause(underlying); newd != oldd {
			log.Printf("Mask cause %[1]T(%[1]v)->%[2]T(%[2]v)", oldd, newd)
			log.Printf("call stack: %s", callers(0, 20))
			log.Printf("len(allow) == %d", len(pass))
			log.Printf("old error %#v", underlying)
			log.Printf("new error %#v", newErr)
		}
	}
	newErr.SetLocation(1)
	return newErr
}
func Mask(underlying error, pass ...func(error) bool) error {
	if underlying == nil {
		return nil
	}
	err := noteMask(underlying, "", pass...)
	setLocation(err, 1)
	return err
}
func Notef(underlying error, f string, a ...interface{}) error {
	err := noteMask(underlying, fmt.Sprintf(f, a...))
	setLocation(err, 1)
	return err
}