mirror of
https://github.com/zeromicro/go-zero.git
synced 2025-01-23 17:20:24 +08:00
13 lines
204 B
Go
13 lines
204 B
Go
package errorx
|
|
|
|
// Chain runs funs one by one until an error occurred.
|
|
func Chain(fns ...func() error) error {
|
|
for _, fn := range fns {
|
|
if err := fn(); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|