| 119 | } |
| 120 | |
| 121 | func getAuthors() *authorSet { |
| 122 | bs, err := os.ReadFile("AUTHORS") |
| 123 | if err != nil { |
| 124 | log.Fatal(err) |
| 125 | } |
| 126 | |
| 127 | lines := strings.Split(string(bs), "\n") |
| 128 | authors := &authorSet{ |
| 129 | emails: make(map[string]int), |
| 130 | commits: make(map[string]stringSet), |
| 131 | } |
| 132 | for _, line := range lines { |
| 133 | if len(line) == 0 || line[0] == '#' { |
| 134 | continue |
| 135 | } |
| 136 | |
| 137 | fields := strings.Fields(line) |
| 138 | var author author |
| 139 | for _, field := range fields { |
| 140 | if field == "#" { |
| 141 | break |
| 142 | } else if m := nicknameRe.FindStringSubmatch(field); len(m) > 1 { |
| 143 | author.nickname = m[1] |
| 144 | } else if m := emailRe.FindStringSubmatch(field); len(m) > 1 { |
| 145 | author.emails = append(author.emails, m[1]) |
| 146 | } else { |
| 147 | if author.name == "" { |
| 148 | author.name = field |
| 149 | } else { |
| 150 | author.name = author.name + " " + field |
| 151 | } |
| 152 | } |
| 153 | } |
| 154 | |
| 155 | authors.add(author) |
| 156 | } |
| 157 | return authors |
| 158 | } |
| 159 | |
| 160 | // list of commits that we don't include in our author file; because they |
| 161 | // are legacy things that don't affect code, are committed with incorrect |