diff options
author | TomSweeneyRedHat <tsweeney@redhat.com> | 2020-01-14 14:46:46 -0500 |
---|---|---|
committer | TomSweeneyRedHat <tsweeney@redhat.com> | 2020-01-14 14:46:46 -0500 |
commit | f5bda9994d5e6cb1ee42ade5e7786059feedf633 (patch) | |
tree | 4473a0c3b4615ee58165f06ccf57a1bfe4298fe9 /vendor/github.com/pkg/errors/cause.go | |
parent | 564bd693cae4e8a870be7a7860ef673e793f6358 (diff) | |
download | podman-f5bda9994d5e6cb1ee42ade5e7786059feedf633.tar.gz podman-f5bda9994d5e6cb1ee42ade5e7786059feedf633.tar.bz2 podman-f5bda9994d5e6cb1ee42ade5e7786059feedf633.zip |
Bump to Buildah v1.13.1
Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>
Diffstat (limited to 'vendor/github.com/pkg/errors/cause.go')
-rw-r--r-- | vendor/github.com/pkg/errors/cause.go | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/vendor/github.com/pkg/errors/cause.go b/vendor/github.com/pkg/errors/cause.go new file mode 100644 index 000000000..566f88bb0 --- /dev/null +++ b/vendor/github.com/pkg/errors/cause.go @@ -0,0 +1,29 @@ +// +build !go1.13 + +package errors + +// Cause recursively unwraps an error chain and returns the underlying cause of +// the error, if possible. An error value has a cause if it implements the +// following interface: +// +// type causer interface { +// Cause() error +// } +// +// If the error does not implement Cause, the original error will +// be returned. If the error is nil, nil will be returned without further +// investigation. +func Cause(err error) error { + type causer interface { + Cause() error + } + + for err != nil { + cause, ok := err.(causer) + if !ok { + break + } + err = cause.Cause() + } + return err +} |