mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
Revert "build: use slices package for sorting (#27486)"
This reverts commit 3ecc4c4b2d.
This commit is contained in:
parent
7f7dab86e5
commit
684d1ed98d
1 changed files with 9 additions and 5 deletions
|
|
@ -46,13 +46,12 @@ import (
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"regexp"
|
"regexp"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
"sort"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"text/template"
|
"text/template"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"golang.org/x/exp/slices"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
@ -153,6 +152,13 @@ func (i info) gpl() bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// authors implements the sort.Interface for strings in case-insensitive mode.
|
||||||
|
type authors []string
|
||||||
|
|
||||||
|
func (as authors) Len() int { return len(as) }
|
||||||
|
func (as authors) Less(i, j int) bool { return strings.ToLower(as[i]) < strings.ToLower(as[j]) }
|
||||||
|
func (as authors) Swap(i, j int) { as[i], as[j] = as[j], as[i] }
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
var (
|
var (
|
||||||
files = getFiles()
|
files = getFiles()
|
||||||
|
|
@ -293,9 +299,7 @@ func writeAuthors(files []string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Write sorted list of authors back to the file.
|
// Write sorted list of authors back to the file.
|
||||||
slices.SortFunc(list, func(a, b string) bool {
|
sort.Sort(authors(list))
|
||||||
return strings.ToLower(a) < strings.ToLower(b)
|
|
||||||
})
|
|
||||||
content := new(bytes.Buffer)
|
content := new(bytes.Buffer)
|
||||||
content.WriteString(authorsFileHeader)
|
content.WriteString(authorsFileHeader)
|
||||||
for _, a := range list {
|
for _, a := range list {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue