gitlab.com/evatix-go/core@v1.3.55/errcore/MergeErrors.go (about) 1 package errcore 2 3 import ( 4 "gitlab.com/evatix-go/core/constants" 5 ) 6 7 func MergeErrors(errorItems ...error) error { 8 if len(errorItems) == 0 { 9 return nil 10 } 11 12 sliceErr := make( 13 []string, 14 constants.Zero, 15 len(errorItems)) 16 17 for _, err := range errorItems { 18 if err == nil { 19 continue 20 } 21 22 sliceErr = append(sliceErr, err.Error()) 23 } 24 25 return SliceToError(sliceErr) 26 }