17 lines
261 B
Go
17 lines
261 B
Go
|
package collect
|
||
|
|
||
|
func Errors(errorChannel <-chan error) []error {
|
||
|
errorList := make([]error, 0)
|
||
|
for {
|
||
|
select {
|
||
|
case err, more := <-errorChannel:
|
||
|
if more {
|
||
|
errorList = append(errorList, err)
|
||
|
continue
|
||
|
}
|
||
|
default:
|
||
|
return errorList
|
||
|
}
|
||
|
}
|
||
|
}
|