Skip to content

Commit

Permalink
refactor: replace golang.org/x/exp with stdlib
Browse files Browse the repository at this point in the history
These experimental packages are now available in the Go standard
library:

	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]>
  • Loading branch information
Juneezee committed Jan 15, 2025
1 parent 5972517 commit cbc32f6
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 9 deletions.
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ require (
github.com/stretchr/testify v1.10.0
go.opentelemetry.io/otel v1.33.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.33.0
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56
k8s.io/api v0.32.0
k8s.io/apimachinery v0.32.0
k8s.io/client-go v0.32.0
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -458,8 +458,6 @@ golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDf
golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs=
golang.org/x/crypto v0.32.0 h1:euUpcYgM8WcP71gNpTqQCn6rC2t6ULUPiOzfWaXVVfc=
golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc=
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 h1:2dVuKD2vS7b0QIHQbpyTISPd0LeHDbnYEryqj5Q1ug8=
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56/go.mod h1:M4RDyNAINzryxdtnbRXRL/OHtkFuWGRjvuhBJpk2IlY=
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
Expand Down
8 changes: 4 additions & 4 deletions internal/k8s/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,18 @@ import (
"context"
"fmt"
"log/slog"
"maps"
"net"
"os"
"slices"
"strconv"
"strings"
"sync"
"time"

"github.com/nginx/kubernetes-ingress/internal/telemetry"
"golang.org/x/exp/maps"

"github.com/nginx/kubernetes-ingress/internal/k8s/appprotect"
"github.com/nginx/kubernetes-ingress/internal/k8s/appprotectdos"
"github.com/nginx/kubernetes-ingress/internal/telemetry"
"k8s.io/client-go/informers"
"k8s.io/client-go/rest"

Expand Down Expand Up @@ -3147,7 +3147,7 @@ func (lbc *LoadBalancerController) getEndpointsForPortFromEndpointSlices(endpoin
endpointSet[podEndpoint] = struct{}{}
}
}
return maps.Keys(endpointSet)
return slices.Collect(maps.Keys(endpointSet))
}

endpoints := makePodEndpoints(targetPort, filterReadyEndpointsFrom(selectEndpointSlicesForPort(targetPort, endpointSlices)))
Expand Down
3 changes: 1 addition & 2 deletions pkg/apis/externaldns/validation/externaldns.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ package validation
import (
"errors"
"fmt"
"slices"
"strings"

"golang.org/x/exp/slices"

v1 "github.com/nginx/kubernetes-ingress/pkg/apis/externaldns/v1"
"k8s.io/apimachinery/pkg/util/validation"
"k8s.io/apimachinery/pkg/util/validation/field"
Expand Down

0 comments on commit cbc32f6

Please sign in to comment.