11func NewValidator(domains []string, usersFile string) func(string) bool {
12 validUsers := make(map[string]bool)
15 log.Printf("using authenticated emails file %s", usersFile)
16 r, err := os.Open(usersFile)
18 log.Fatalf("failed opening authenticated-emails-file=%q, %s", usersFile, err)
20 csv_reader := csv.NewReader(r)
21 csv_reader.Comma = ','
22 csv_reader.Comment = '#'
23 csv_reader.TrimLeadingSpace = true
24 records, err := csv_reader.ReadAll()
25 for _, r := range records {
26 validUsers[r[0]] = true
30 validator := func(email string) bool {
32 for _, domain := range domains {
33 emailSuffix := fmt.Sprintf("@%s", domain)
34 valid = valid || strings.HasSuffix(email, emailSuffix)
37 _, valid = validUsers[email]
39 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