From 6e456250f7ceb5a89da60223ae16ce6cbe563398 Mon Sep 17 00:00:00 2001 From: Teppei Fukuda Date: Mon, 4 Sep 2017 22:25:57 +0800 Subject: [PATCH] Erros skip nil in Add function (#1566) --- errors.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/errors.go b/errors.go index 832fa9b0..6845188e 100644 --- a/errors.go +++ b/errors.go @@ -29,6 +29,10 @@ func (errs Errors) GetErrors() []error { // Add adds an error func (errs Errors) Add(newErrors ...error) Errors { for _, err := range newErrors { + if err == nil { + continue + } + if errors, ok := err.(Errors); ok { errs = errs.Add(errors...) } else {