示例#1
0
func NewSimpleChecker(pwdlen int) (*SimpleChecker, error) {
	var err error

	c := SimpleChecker{}
	c.emailregex, err = regexp.Compile(`^[a-z0-9._%+\-]+@[a-z0-9.\-]+\.[a-z]{2,4}$`)
	c.pwdlen = pwdlen
	return &c, errs.Err(err, "cannot complie regex")
}
示例#2
0
文件: confg.go 项目: kidstuff/toys
func Open(name, path string) (Configurator, error) {
	config, ok := configurators[name]
	if !ok {
		return nil, ErrConfiguratorNotFound
	}

	err := config.Load(path)
	if err != nil {
		return nil, errs.Err(err, "confg: cannot Open")
	}

	return config, nil
}