Skip to content

Commit ad332b3

Browse files
committed
use std API instead of exp API
Signed-off-by: sivchari <shibuuuu5@gmail.com>
1 parent 850efe7 commit ad332b3

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ require (
3535
go.etcd.io/etcd/client/pkg/v3 v3.5.18
3636
go.etcd.io/etcd/client/v3 v3.5.18
3737
go.uber.org/zap v1.27.0
38-
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56
38+
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect
3939
golang.org/x/oauth2 v0.25.0
4040
golang.org/x/text v0.21.0
4141
gomodules.xyz/jsonpatch/v2 v2.4.0

internal/controllers/machine/drain/drain.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,14 @@ package drain
2020
import (
2121
"context"
2222
"fmt"
23+
"maps"
2324
"math"
25+
"slices"
2426
"sort"
2527
"strings"
2628
"time"
2729

2830
"github.com/pkg/errors"
29-
"golang.org/x/exp/maps"
3031
corev1 "k8s.io/api/core/v1"
3132
policyv1 "k8s.io/api/policy/v1"
3233
apierrors "k8s.io/apimachinery/pkg/api/errors"
@@ -484,8 +485,7 @@ func (r EvictionResult) ConditionMessage(nodeDrainStartTime *metav1.Time) string
484485
conditionMessage, kind, PodListToString(r.PodsDeletionTimestampSet, 3))
485486
}
486487
if len(r.PodsFailedEviction) > 0 {
487-
sortedFailureMessages := maps.Keys(r.PodsFailedEviction)
488-
sort.Strings(sortedFailureMessages)
488+
sortedFailureMessages := slices.Sorted(maps.Keys(r.PodsFailedEviction))
489489

490490
skippedFailureMessages := []string{}
491491
if len(sortedFailureMessages) > 5 {

internal/controllers/topology/cluster/current_state_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,13 @@ limitations under the License.
1717
package cluster
1818

1919
import (
20+
"maps"
21+
"slices"
2022
"testing"
2123
"time"
2224

2325
"github.com/google/go-cmp/cmp"
2426
. "github.com/onsi/gomega"
25-
"golang.org/x/exp/maps"
2627
corev1 "k8s.io/api/core/v1"
2728
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2829
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
@@ -1166,7 +1167,7 @@ func TestGetCurrentState(t *testing.T) {
11661167
}
11671168

11681169
// Don't compare the deletionTimestamps as there are some minor differences in how they are stored pre/post fake client.
1169-
for _, md := range append(maps.Values(got.MachineDeployments), maps.Values(tt.want.MachineDeployments)...) {
1170+
for _, md := range append(slices.Collect(maps.Values(got.MachineDeployments)), slices.Collect(maps.Values(tt.want.MachineDeployments))...) {
11701171
md.Object.DeletionTimestamp = nil
11711172
}
11721173

0 commit comments

Comments
 (0)