aboutsummaryrefslogtreecommitdiff
path: root/weed/storage/disk_location_ec.go
diff options
context:
space:
mode:
authorjustin <leyou240@live.cn>2022-04-18 10:35:43 +0800
committerjustin <leyou240@live.cn>2022-04-18 10:35:43 +0800
commit3551ca2fcf423464afb2db4b5792c22ec94c2bfd (patch)
treeee1f372e32fb03d93aeb0825ec0f068ef1fce161 /weed/storage/disk_location_ec.go
parentc6ec5269f4b34d79ab8e13050623501b8befda32 (diff)
downloadseaweedfs-3551ca2fcf423464afb2db4b5792c22ec94c2bfd.tar.xz
seaweedfs-3551ca2fcf423464afb2db4b5792c22ec94c2bfd.zip
enhancement: replace sort.Slice with slices.SortFunc to reduce reflection
Diffstat (limited to 'weed/storage/disk_location_ec.go')
-rw-r--r--weed/storage/disk_location_ec.go8
1 files changed, 3 insertions, 5 deletions
diff --git a/weed/storage/disk_location_ec.go b/weed/storage/disk_location_ec.go
index 3f56d797b..5fa5316fd 100644
--- a/weed/storage/disk_location_ec.go
+++ b/weed/storage/disk_location_ec.go
@@ -2,10 +2,10 @@ package storage
import (
"fmt"
+ "golang.org/x/exp/slices"
"os"
"path"
"regexp"
- "sort"
"strconv"
"github.com/chrislusf/seaweedfs/weed/storage/erasure_coding"
@@ -128,11 +128,9 @@ func (l *DiskLocation) loadAllEcShards() (err error) {
}
dirEntries = append(dirEntries, indexDirEntries...)
}
-
- sort.Slice(dirEntries, func(i, j int) bool {
- return dirEntries[i].Name() < dirEntries[j].Name()
+ slices.SortFunc(dirEntries, func(a, b os.DirEntry) bool {
+ return a.Name() < b.Name()
})
-
var sameVolumeShards []string
var prevVolumeId needle.VolumeId
for _, fileInfo := range dirEntries {