diff --git a/hack/golangci.yaml b/hack/golangci.yaml index 7eb4e0abff4..3faadfb8b0e 100644 --- a/hack/golangci.yaml +++ b/hack/golangci.yaml @@ -597,14 +597,6 @@ linters: # A useful hint because it can make code more obvious # and/or avoid helper functions. - slicescontains - # Replace sort.Slice with slices.Sort for basic types. - # - # A useful hint because the code becomes shorter. - - slicessort - # Use iterators instead of Len/At-style APIs. - # - # A useful hint because the code becomes shorter. - - stditerators # Replace HasPrefix/TrimPrefix with CutPrefix. # # A useful hint because the code becomes shorter. diff --git a/hack/golangci.yaml.in b/hack/golangci.yaml.in index cb944797726..9a07f521cf3 100644 --- a/hack/golangci.yaml.in +++ b/hack/golangci.yaml.in @@ -333,14 +333,6 @@ linters: # A useful hint because it can make code more obvious # and/or avoid helper functions. - slicescontains - # Replace sort.Slice with slices.Sort for basic types. - # - # A useful hint because the code becomes shorter. - - slicessort - # Use iterators instead of Len/At-style APIs. - # - # A useful hint because the code becomes shorter. - - stditerators # Replace HasPrefix/TrimPrefix with CutPrefix. # # A useful hint because the code becomes shorter. diff --git a/pkg/controller/volume/selinuxwarning/cache/volumecache.go b/pkg/controller/volume/selinuxwarning/cache/volumecache.go index 4b19c985c86..50dd0d60156 100644 --- a/pkg/controller/volume/selinuxwarning/cache/volumecache.go +++ b/pkg/controller/volume/selinuxwarning/cache/volumecache.go @@ -17,6 +17,7 @@ limitations under the License. package cache import ( + "slices" "sort" "sync" @@ -195,9 +196,7 @@ func (c *volumeCache) dump(logger klog.Logger) { for volumeID := range c.volumes { volumeIDs = append(volumeIDs, volumeID) } - sort.Slice(volumeIDs, func(i, j int) bool { - return volumeIDs[i] < volumeIDs[j] - }) + slices.Sort(volumeIDs) for _, volumeID := range volumeIDs { volume := c.volumes[volumeID] logger.Info("Cached volume", "volume", volumeID, "csiDriver", volume.csiDriver) diff --git a/pkg/scheduler/framework/plugins/dynamicresources/extendeddynamicresources.go b/pkg/scheduler/framework/plugins/dynamicresources/extendeddynamicresources.go index 1c677e728cd..e7fc75ed4be 100644 --- a/pkg/scheduler/framework/plugins/dynamicresources/extendeddynamicresources.go +++ b/pkg/scheduler/framework/plugins/dynamicresources/extendeddynamicresources.go @@ -419,9 +419,7 @@ func createRequestsAndMappings(pod *v1.Pod, extendedResources map[v1.ResourceNam for resource := range extendedResources { resourceNames = append(resourceNames, resource) } - sort.Slice(resourceNames, func(i, j int) bool { - return resourceNames[i] < resourceNames[j] - }) + slices.Sort(resourceNames) for _, resource := range resourceNames { class := deviceClassMapping.GetDeviceClass(resource)