Skip to content

Commit eddf521

Browse files
JuneezeeFxKu
andauthored
Replace golang.org/x/exp with stdlib (#2857)
* Replace `golang.org/x/exp` with stdlib These experimental packages are now available in the Go standard library since Go 1.21. 1. golang.org/x/exp/slices -> slices [1] 2. golang.org/x/exp/maps -> maps [2] [1]: https://go.dev/doc/go1.21#slices [2]: https://go.dev/doc/go1.21#maps Signed-off-by: Eng Zer Jun <[email protected]> * Run go mod tidy Signed-off-by: Eng Zer Jun <[email protected]> --------- Signed-off-by: Eng Zer Jun <[email protected]> Co-authored-by: Felix Kunde <[email protected]>
1 parent 8ba57b2 commit eddf521

File tree

6 files changed

+11
-18
lines changed

6 files changed

+11
-18
lines changed

go.mod

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ module github.com/zalando/postgres-operator
33
go 1.25.0
44

55
require (
6+
github.com/Masterminds/semver v1.5.0
67
github.com/aws/aws-sdk-go v1.53.8
78
github.com/golang/mock v1.6.0
89
github.com/lib/pq v1.10.9
@@ -12,7 +13,6 @@ require (
1213
github.com/sirupsen/logrus v1.9.3
1314
github.com/stretchr/testify v1.9.0
1415
golang.org/x/crypto v0.41.0
15-
golang.org/x/exp v0.0.0-20240112132812-db7319d0e0e3
1616
gopkg.in/yaml.v2 v2.4.0
1717
k8s.io/api v0.30.4
1818
k8s.io/apiextensions-apiserver v0.25.9
@@ -21,10 +21,7 @@ require (
2121
k8s.io/code-generator v0.25.9
2222
)
2323

24-
require golang.org/x/tools/go/packages/packagestest v0.1.1-deprecated // indirect
25-
2624
require (
27-
github.com/Masterminds/semver v1.5.0
2825
github.com/davecgh/go-spew v1.1.1 // indirect
2926
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
3027
github.com/evanphx/json-patch v4.12.0+incompatible // indirect
@@ -62,6 +59,7 @@ require (
6259
golang.org/x/text v0.28.0 // indirect
6360
golang.org/x/time v0.3.0 // indirect
6461
golang.org/x/tools v0.36.0 // indirect
62+
golang.org/x/tools/go/packages/packagestest v0.1.1-deprecated // indirect
6563
google.golang.org/appengine v1.6.7 // indirect
6664
google.golang.org/protobuf v1.33.0 // indirect
6765
gopkg.in/inf.v0 v0.9.1 // indirect

go.sum

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,6 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U
121121
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
122122
golang.org/x/crypto v0.41.0 h1:WKYxWedPGCTVVl5+WHSSrOBT0O8lx32+zxmHxijgXp4=
123123
golang.org/x/crypto v0.41.0/go.mod h1:pO5AFd7FA68rFak7rOAGVuygIISepHftHnr8dr6+sUc=
124-
golang.org/x/exp v0.0.0-20240112132812-db7319d0e0e3 h1:hNQpMuAJe5CtcUqCXaWga3FHu+kQvCqcsoVaQgSV60o=
125-
golang.org/x/exp v0.0.0-20240112132812-db7319d0e0e3/go.mod h1:idGWGoKP1toJGkd5/ig9ZLuPcZBC3ewk7SzmH0uou08=
126124
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
127125
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
128126
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=

pkg/cluster/k8sres.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,26 @@ import (
44
"context"
55
"encoding/json"
66
"fmt"
7+
"maps"
78
"path"
9+
"slices"
810
"sort"
911
"strings"
1012

1113
"github.com/pkg/errors"
1214
"github.com/sirupsen/logrus"
1315

1416
appsv1 "k8s.io/api/apps/v1"
17+
batchv1 "k8s.io/api/batch/v1"
1518
v1 "k8s.io/api/core/v1"
1619
policyv1 "k8s.io/api/policy/v1"
1720
apierrors "k8s.io/apimachinery/pkg/api/errors"
1821
"k8s.io/apimachinery/pkg/api/resource"
1922
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
23+
"k8s.io/apimachinery/pkg/labels"
2024
"k8s.io/apimachinery/pkg/types"
2125
"k8s.io/apimachinery/pkg/util/intstr"
2226

23-
"golang.org/x/exp/maps"
24-
"golang.org/x/exp/slices"
25-
batchv1 "k8s.io/api/batch/v1"
26-
"k8s.io/apimachinery/pkg/labels"
27-
2827
acidv1 "github.com/zalando/postgres-operator/pkg/apis/acid.zalan.do/v1"
2928
"github.com/zalando/postgres-operator/pkg/spec"
3029
"github.com/zalando/postgres-operator/pkg/util"

pkg/cluster/pod.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@ package cluster
33
import (
44
"context"
55
"fmt"
6+
"slices"
67
"sort"
78
"strconv"
89
"time"
910

10-
"golang.org/x/exp/slices"
11-
1211
appsv1 "k8s.io/api/apps/v1"
1312
v1 "k8s.io/api/core/v1"
1413
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

pkg/cluster/sync.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ import (
44
"context"
55
"encoding/json"
66
"fmt"
7+
"maps"
78
"reflect"
89
"regexp"
10+
"slices"
911
"strconv"
1012
"strings"
1113
"time"
@@ -15,8 +17,6 @@ import (
1517
"github.com/zalando/postgres-operator/pkg/util"
1618
"github.com/zalando/postgres-operator/pkg/util/constants"
1719
"github.com/zalando/postgres-operator/pkg/util/k8sutil"
18-
"golang.org/x/exp/maps"
19-
"golang.org/x/exp/slices"
2020
batchv1 "k8s.io/api/batch/v1"
2121
v1 "k8s.io/api/core/v1"
2222
policyv1 "k8s.io/api/policy/v1"

pkg/cluster/sync_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,14 @@ package cluster
22

33
import (
44
"bytes"
5+
"context"
56
"fmt"
67
"io"
78
"net/http"
9+
"slices"
810
"testing"
911
"time"
1012

11-
"context"
12-
13-
"golang.org/x/exp/slices"
1413
v1 "k8s.io/api/core/v1"
1514
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1615
"k8s.io/apimachinery/pkg/types"

0 commit comments

Comments
 (0)