aboutsummaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2019-07-22 17:31:11 +0800
committerPéter Szilágyi <peterke@gmail.com>2019-07-22 17:31:11 +0800
commitb973eddd2830fb4743e0e69d026eafbb97a40c79 (patch)
treef7bf12838cfa08e0a49e646f98b7c1b7587cf63f /build
parent1a83114c74b66c13b025e4a7df1c45e7ade42e05 (diff)
downloadgo-tangerine-b973eddd2830fb4743e0e69d026eafbb97a40c79.tar
go-tangerine-b973eddd2830fb4743e0e69d026eafbb97a40c79.tar.gz
go-tangerine-b973eddd2830fb4743e0e69d026eafbb97a40c79.tar.bz2
go-tangerine-b973eddd2830fb4743e0e69d026eafbb97a40c79.tar.lz
go-tangerine-b973eddd2830fb4743e0e69d026eafbb97a40c79.tar.xz
go-tangerine-b973eddd2830fb4743e0e69d026eafbb97a40c79.tar.zst
go-tangerine-b973eddd2830fb4743e0e69d026eafbb97a40c79.zip
build: deduplicate same authors with different casing
Diffstat (limited to 'build')
-rw-r--r--build/update-license.go23
1 files changed, 14 insertions, 9 deletions
diff --git a/build/update-license.go b/build/update-license.go
index 1bad7585d..aa4d6100d 100644
--- a/build/update-license.go
+++ b/build/update-license.go
@@ -275,27 +275,32 @@ func mailmapLookup(authors []string) []string {
}
func writeAuthors(files []string) {
- merge := make(map[string]bool)
+ var (
+ dedup = make(map[string]bool)
+ list []string
+ )
// Add authors that Git reports as contributors.
// This is the primary source of author information.
for _, a := range gitAuthors(files) {
- merge[a] = true
+ if la := strings.ToLower(a); !dedup[la] {
+ list = append(list, a)
+ dedup[la] = true
+ }
}
// Add existing authors from the file. This should ensure that we
// never lose authors, even if Git stops listing them. We can also
// add authors manually this way.
for _, a := range readAuthors() {
- merge[a] = true
+ if la := strings.ToLower(a); !dedup[la] {
+ list = append(list, a)
+ dedup[la] = true
+ }
}
// Write sorted list of authors back to the file.
- var result []string
- for a := range merge {
- result = append(result, a)
- }
- sort.Sort(authors(result))
+ sort.Sort(authors(list))
content := new(bytes.Buffer)
content.WriteString(authorsFileHeader)
- for _, a := range result {
+ for _, a := range list {
content.WriteString(a)
content.WriteString("\n")
}