diff --git a/CHANGELOG.md b/CHANGELOG.md index df2a1987770..a2fd5f466cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -90,6 +90,7 @@ New deprecation(s): ### Other - **General**: Bump newrelic-client-go deps to 2.51.2 (latest) ([#6325](https://github.com/kedacore/keda/pull/6325)) +- **General**: refactor: replace experimental `maps` and `slices` with stdlib ([#6372](https://github.com/kedacore/keda/pull/6372)) ## v2.16.0 diff --git a/apis/eventing/v1alpha1/cloudeventsource_webhook.go b/apis/eventing/v1alpha1/cloudeventsource_webhook.go index af7e69d7fb4..2dc577665de 100644 --- a/apis/eventing/v1alpha1/cloudeventsource_webhook.go +++ b/apis/eventing/v1alpha1/cloudeventsource_webhook.go @@ -19,8 +19,8 @@ package v1alpha1 import ( "encoding/json" "fmt" + "slices" - "golang.org/x/exp/slices" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" ctrl "sigs.k8s.io/controller-runtime" diff --git a/go.mod b/go.mod index 5046aa24845..ad97fd12ad6 100644 --- a/go.mod +++ b/go.mod @@ -345,7 +345,7 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect golang.org/x/crypto v0.28.0 - golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa + golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa // indirect golang.org/x/mod v0.21.0 // indirect golang.org/x/net v0.30.0 // indirect golang.org/x/sys v0.28.0 // indirect diff --git a/pkg/eventemitter/eventfilter.go b/pkg/eventemitter/eventfilter.go index 11af3af1ac8..b6b0dc32b0e 100644 --- a/pkg/eventemitter/eventfilter.go +++ b/pkg/eventemitter/eventfilter.go @@ -17,7 +17,7 @@ limitations under the License. package eventemitter import ( - "golang.org/x/exp/slices" + "slices" eventingv1alpha1 "github.com/kedacore/keda/v2/apis/eventing/v1alpha1" ) diff --git a/pkg/scalers/scalersconfig/typed_config.go b/pkg/scalers/scalersconfig/typed_config.go index 4e61f3e288d..6bb37436f7d 100644 --- a/pkg/scalers/scalersconfig/typed_config.go +++ b/pkg/scalers/scalersconfig/typed_config.go @@ -20,14 +20,13 @@ import ( "encoding/json" "errors" "fmt" + "maps" "net/url" "reflect" "runtime/debug" + "slices" "strconv" "strings" - - "golang.org/x/exp/maps" - "golang.org/x/exp/slices" ) // CustomValidator is an interface that can be implemented to validate the configuration of the typed config @@ -204,8 +203,7 @@ func (sc *ScalerConfig) setValue(field reflect.Value, params Params) error { } if !exists && !(params.Optional || params.IsDeprecated()) { if len(params.Order) == 0 { - apo := maps.Keys(allowedParsingOrderMap) - slices.Sort(apo) + apo := slices.Sorted(maps.Keys(allowedParsingOrderMap)) return fmt.Errorf("missing required parameter %q, no 'order' tag, provide any from %v", params.Name(), apo) } return fmt.Errorf("missing required parameter %q in %v", params.Name(), params.Order) @@ -455,8 +453,7 @@ func paramsFromTag(tag string, field reflect.StructField) (Params, error) { for _, po := range order { poTyped := ParsingOrder(strings.TrimSpace(po)) if !allowedParsingOrderMap[poTyped] { - apo := maps.Keys(allowedParsingOrderMap) - slices.Sort(apo) + apo := slices.Sorted(maps.Keys(allowedParsingOrderMap)) return params, fmt.Errorf("unknown parsing order value %s, has to be one of %s", po, apo) } params.Order = append(params.Order, poTyped) diff --git a/tests/sequential/opentelemetry_metrics/opentelemetry_metrics_test.go b/tests/sequential/opentelemetry_metrics/opentelemetry_metrics_test.go index be9fafdc46e..98e287e2d08 100644 --- a/tests/sequential/opentelemetry_metrics/opentelemetry_metrics_test.go +++ b/tests/sequential/opentelemetry_metrics/opentelemetry_metrics_test.go @@ -9,6 +9,7 @@ import ( "fmt" "maps" "os/exec" + "slices" "strings" "testing" "time" @@ -17,7 +18,6 @@ import ( "github.com/prometheus/common/expfmt" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "golang.org/x/exp/slices" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/kubernetes"