stash/pkg/utils/func.go

13 lines
254 B
Go
Raw Permalink Normal View History

2022-12-22 22:15:27 +00:00
package utils
// Do executes each function in the slice in order. If any function returns an error, it is returned immediately.
func Do(fn []func() error) error {
for _, f := range fn {
if err := f(); err != nil {
return err
}
}
return nil
}