11func NewValidator(domains []string, usersFile string) func(string) bool {
12 validUsers := make(map[string]bool)
15 r, err := os.Open(usersFile)
17 log.Fatalf("failed opening -authenticated-emails-file=%v, %s", usersFile, err.Error())
19 csv_reader := csv.NewReader(r)
20 csv_reader.Comma = ','
21 csv_reader.Comment = '#'
22 csv_reader.TrimLeadingSpace = true
23 records, err := csv_reader.ReadAll()
24 for _, r := range records {
25 validUsers[r[0]] = true
29 validator := func(email string) bool {
31 for _, domain := range domains {
32 emailSuffix := fmt.Sprintf("@%s", domain)
33 valid = valid || strings.HasSuffix(email, emailSuffix)
36 _, valid = validUsers[email]
38 log.Printf("validating: is %s valid? %v", email, valid)
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list