8 lines
245 B
Go
8 lines
245 B
Go
package errorx
|
|
|
|
import "github.com/tkw1536/goprogram/lib/collection"
|
|
|
|
// First returns the first non-nil error, or nil otherwise.
|
|
func First(errors ...error) error {
|
|
return collection.First(errors, func(err error) bool { return err != nil })
|
|
}
|