func (wf *Workflow) Match(fpath string, op Op) bool {
	if wf.matchOp(op) {
		for _, r := range wf.Regexs {
			if r.MatchString(fpath) {
				return true
			}
		}
	}
	return false
}
Match checks a file name against the regexp of the Workflow and the file operation
package goauto
import (
	"fmt"
	"regexp"
	"time"
)
type Workflow struct {
	Name       string
	Concurrent bool
	Op         Op
	Regexs     []*regexp.Regexp
	Tasks      []Tasker
}
func NewWorkflow(tasks ...Tasker) *Workflow {
	wf := new(Workflow)
	wf.WatchOp(Create | Write | Remove | Rename)
	wf.Add(tasks...)
	return wf
}
func (wf *Workflow) WatchPattern(patterns ...string) error {
	if wf.Op == 0 {
		wf.WatchOp(Create | Write | Remove | Rename)
	}
	for _, p := range patterns {
		r, err := regexp.Compile(p)
		if err != nil {
			return err
		}
		wf.Regexs = append(wf.Regexs, r)
	}
	return nil
}
func (wf *Workflow) WatchOp(op Op) {
	wf.Op = op
}
func (wf *Workflow) matchOp(op Op) bool {
	switch {
	case wf.Op&Create == op&Create:
		return true
	case wf.Op&Write == op&Write:
		return true
	case wf.Op&Remove == op&Remove:
		return true
	case wf.Op&Rename == op&Rename:
		return true
	case wf.Op&Chmod == op&Chmod:
		return true
	}
	return false
}