Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: replace experimental maps and slices with stdlib #6372

Merged
merged 5 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,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
Expand Down
2 changes: 1 addition & 1 deletion apis/eventing/v1alpha1/cloudeventsource_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 2 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
module github.com/kedacore/keda/v2

go 1.22.1

toolchain go1.23.3
zroubalik marked this conversation as resolved.
Show resolved Hide resolved
go 1.23.3

require (
cloud.google.com/go/compute/metadata v0.5.2
Expand Down Expand Up @@ -347,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.26.0 // indirect
Expand Down
2 changes: 1 addition & 1 deletion pkg/eventemitter/eventfilter.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down
11 changes: 4 additions & 7 deletions pkg/scalers/scalersconfig/typed_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -463,8 +461,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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"fmt"
"maps"
"os/exec"
"slices"
"strings"
"testing"
"time"
Expand All @@ -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"
Expand Down
Loading