@@ -20,7 +20,7 @@ import (
20
20
"context"
21
21
"errors"
22
22
"fmt"
23
- "sort "
23
+ "slices "
24
24
"strconv"
25
25
"strings"
26
26
"time"
@@ -332,7 +332,7 @@ func (vm *volumeManager) GetExtraSupplementalGroupsForPod(pod *v1.Pod) []int64 {
332
332
}
333
333
334
334
result := make ([]int64 , 0 , supplementalGroups .Len ())
335
- for _ , group := range sets . List ( supplementalGroups ) {
335
+ for _ , group := range supplementalGroups . UnsortedList ( ) {
336
336
iGroup , extra := getExtraSupplementalGid (group , pod )
337
337
if ! extra {
338
338
continue
@@ -370,9 +370,7 @@ func (vm *volumeManager) GetVolumesInUse() []v1.UniqueVolumeName {
370
370
}
371
371
}
372
372
373
- sort .Slice (volumesToReportInUse , func (i , j int ) bool {
374
- return string (volumesToReportInUse [i ]) < string (volumesToReportInUse [j ])
375
- })
373
+ slices .Sort (volumesToReportInUse )
376
374
return volumesToReportInUse
377
375
}
378
376
@@ -463,12 +461,11 @@ func (vm *volumeManager) WaitForUnmount(ctx context.Context, pod *v1.Pod) error
463
461
for _ , v := range vm .actualStateOfWorld .GetMountedVolumesForPod (uniquePodName ) {
464
462
mountedVolumes = append (mountedVolumes , v .OuterVolumeSpecName )
465
463
}
466
- sort .Strings (mountedVolumes )
467
-
468
464
if len (mountedVolumes ) == 0 {
469
465
return nil
470
466
}
471
467
468
+ slices .Sort (mountedVolumes )
472
469
return fmt .Errorf (
473
470
"mounted volumes=%v: %w" ,
474
471
mountedVolumes ,
@@ -480,7 +477,7 @@ func (vm *volumeManager) WaitForUnmount(ctx context.Context, pod *v1.Pod) error
480
477
}
481
478
482
479
func (vm * volumeManager ) getVolumesNotInDSW (uniquePodName types.UniquePodName , expectedVolumes []string ) []string {
483
- volumesNotInDSW := sets .New [ string ] (expectedVolumes ... )
480
+ volumesNotInDSW := sets .New (expectedVolumes ... )
484
481
485
482
for _ , volumeToMount := range vm .desiredStateOfWorld .GetVolumesToMount () {
486
483
if volumeToMount .PodName == uniquePodName {
@@ -502,7 +499,7 @@ func (vm *volumeManager) getUnattachedVolumes(uniquePodName types.UniquePodName)
502
499
unattachedVolumes = append (unattachedVolumes , volumeToMount .OuterVolumeSpecName )
503
500
}
504
501
}
505
- sort . Strings (unattachedVolumes )
502
+ slices . Sort (unattachedVolumes )
506
503
507
504
return unattachedVolumes
508
505
}
@@ -550,7 +547,7 @@ func filterUnmountedVolumes(mountedVolumes sets.Set[string], expectedVolumes []s
550
547
unmountedVolumes = append (unmountedVolumes , expectedVolume )
551
548
}
552
549
}
553
- sort . Strings (unmountedVolumes )
550
+ slices . Sort (unmountedVolumes )
554
551
555
552
return unmountedVolumes
556
553
}
0 commit comments