refactor: use slices package for sorting (#10136)

Few more complicated usages of the sort packages are left.

### Purpose

Make progress towards replacing the sort package with slices package.
This commit is contained in:
Marcel Meyer
2025-05-26 20:37:49 +02:00
committed by GitHub
parent 905e5ec07f
commit 598915193a
18 changed files with 107 additions and 152 deletions
+4 -2
View File
@@ -13,7 +13,7 @@ import (
"math/rand"
"path/filepath"
"slices"
"sort"
"strings"
"time"
"github.com/syncthing/syncthing/lib/config"
@@ -1201,7 +1201,9 @@ func (f *folder) Errors() []FileError {
errors := make([]FileError, scanLen+len(f.pullErrors))
copy(errors[:scanLen], f.scanErrors)
copy(errors[scanLen:], f.pullErrors)
sort.Sort(fileErrorList(errors))
slices.SortFunc(errors, func(a, b FileError) int {
return strings.Compare(a.Path, b.Path)
})
return errors
}