aboutsummaryrefslogtreecommitdiff
path: root/weed/s3api/s3api_object_handlers.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/s3api/s3api_object_handlers.go
parentc6ec5269f4b34d79ab8e13050623501b8befda32 (diff)
downloadseaweedfs-3551ca2fcf423464afb2db4b5792c22ec94c2bfd.tar.xz
seaweedfs-3551ca2fcf423464afb2db4b5792c22ec94c2bfd.zip
enhancement: replace sort.Slice with slices.SortFunc to reduce reflection
Diffstat (limited to 'weed/s3api/s3api_object_handlers.go')
-rw-r--r--weed/s3api/s3api_object_handlers.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/weed/s3api/s3api_object_handlers.go b/weed/s3api/s3api_object_handlers.go
index 190045517..3d26d395e 100644
--- a/weed/s3api/s3api_object_handlers.go
+++ b/weed/s3api/s3api_object_handlers.go
@@ -8,10 +8,10 @@ import (
"fmt"
"github.com/chrislusf/seaweedfs/weed/security"
"github.com/chrislusf/seaweedfs/weed/util/mem"
+ "golang.org/x/exp/slices"
"io"
"net/http"
"net/url"
- "sort"
"strings"
"time"
@@ -290,8 +290,8 @@ func (s3a *S3ApiServer) doDeleteEmptyDirectories(client filer_pb.SeaweedFilerCli
for dir, _ := range directoriesWithDeletion {
allDirs = append(allDirs, dir)
}
- sort.Slice(allDirs, func(i, j int) bool {
- return len(allDirs[i]) > len(allDirs[j])
+ slices.SortFunc(allDirs, func(a, b string) bool {
+ return len(a) > len(b)
})
newDirectoriesWithDeletion = make(map[string]int)
for _, dir := range allDirs {