Skip to content

Commit

Permalink
Use stdlib slices (#6018)
Browse files Browse the repository at this point in the history
## What changed?

Switched references from `golang.org/x/exp/slices` to the standard
library package.

## Why?

The stdlib `slices` package was introduced in Go 1.21 so can use it. The
signature changes in #4706 was all the real lifting.

## How did you test it?

Ran unit tests locally. CI for the rest.

## Potential risks

None.

## Documentation

n/a

## Is hotfix candidate?

No.

Co-authored-by: Alex Shtin <alex@temporal.io>
  • Loading branch information
bgerrity and alexshtin authored Jul 26, 2024
1 parent 16c96cc commit 9492ff4
Show file tree
Hide file tree
Showing 25 changed files with 42 additions and 156 deletions.
2 changes: 1 addition & 1 deletion cmd/tools/rpcwrappers/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ import (
"io"
"os"
"reflect"
"slices"
"strings"
"text/template"

"go.temporal.io/api/taskqueue/v1"
"go.temporal.io/api/workflowservice/v1"
"golang.org/x/exp/slices"

"go.temporal.io/server/api/adminservice/v1"
"go.temporal.io/server/api/historyservice/v1"
Expand Down
2 changes: 1 addition & 1 deletion common/headers/version_checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ package headers
import (
"context"
"fmt"
"slices"
"strings"

"github.com/blang/semver/v4"
"golang.org/x/exp/slices"
"google.golang.org/grpc/metadata"

"go.temporal.io/api/serviceerror"
Expand Down
2 changes: 1 addition & 1 deletion common/membership/ringpop/service_resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ import (
"errors"
"math"
"net"
"slices"
"strconv"
"sync"
"sync/atomic"
"time"

"github.com/temporalio/ringpop-go"
"github.com/temporalio/tchannel-go"
"golang.org/x/exp/slices"

"github.com/dgryski/go-farm"
"github.com/temporalio/ringpop-go/events"
Expand Down
2 changes: 1 addition & 1 deletion common/metrics/metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ package metrics_test

import (
"fmt"
"slices"
"time"

"go.temporal.io/server/common/metrics"
"go.temporal.io/server/common/metrics/metricstest"
"golang.org/x/exp/maps"
"golang.org/x/exp/slices"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion common/persistence/client/quotas_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ package client

import (
"reflect"
"slices"
"testing"
"time"

Expand All @@ -34,7 +35,6 @@ import (
"go.temporal.io/server/common/headers"
"go.temporal.io/server/common/quotas"
"go.temporal.io/server/common/testing/temporalapi"
"golang.org/x/exp/slices"

"go.temporal.io/api/workflowservice/v1"
)
Expand Down
2 changes: 1 addition & 1 deletion service/frontend/configs/quotas_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ package configs

import (
"reflect"
"slices"
"testing"
"time"

"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"
"go.temporal.io/api/workflowservice/v1"
"golang.org/x/exp/slices"

"go.temporal.io/server/common/headers"
"go.temporal.io/server/common/quotas"
Expand Down
2 changes: 1 addition & 1 deletion service/frontend/namespace_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ package frontend

import (
"context"
"slices"
"strings"
"testing"
"time"

"go.temporal.io/api/serviceerror"
"golang.org/x/exp/slices"

"github.com/golang/mock/gomock"
"github.com/pborman/uuid"
Expand Down
2 changes: 1 addition & 1 deletion service/history/configs/quotas_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ package configs

import (
"reflect"
"slices"
"testing"
"time"

"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"
"golang.org/x/exp/slices"

"go.temporal.io/server/api/historyservice/v1"
"go.temporal.io/server/common/headers"
Expand Down
2 changes: 1 addition & 1 deletion service/history/ndc/workflow_state_replicator.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ package ndc
import (
"context"
"fmt"
"slices"
"sort"
"time"

commonpb "go.temporal.io/api/common/v1"
historypb "go.temporal.io/api/history/v1"
"go.temporal.io/api/serviceerror"
"golang.org/x/exp/slices"

"go.temporal.io/server/api/adminservice/v1"
enumsspb "go.temporal.io/server/api/enums/v1"
Expand Down
3 changes: 1 addition & 2 deletions service/history/queues/action_pending_task_count.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,9 @@
package queues

import (
"slices"
"time"

"golang.org/x/exp/slices"

"go.temporal.io/server/common/collection"
)

Expand Down
2 changes: 1 addition & 1 deletion service/history/queues/action_slice_count.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
package queues

import (
"golang.org/x/exp/slices"
"slices"

"go.temporal.io/server/service/history/tasks"
)
Expand Down
2 changes: 1 addition & 1 deletion service/history/queues/queue_scheduled_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ import (
"errors"
"math"
"math/rand"
"slices"
"testing"
"time"

gomock "github.com/golang/mock/gomock"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"
"golang.org/x/exp/slices"

persistencespb "go.temporal.io/server/api/persistence/v1"
"go.temporal.io/server/common/cluster"
Expand Down
2 changes: 1 addition & 1 deletion service/history/queues/scope_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ package queues

import (
"math/rand"
"slices"
"testing"
"time"

"github.com/golang/mock/gomock"
"github.com/pborman/uuid"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"
"golang.org/x/exp/slices"

enumsspb "go.temporal.io/server/api/enums/v1"
"go.temporal.io/server/common/predicates"
Expand Down
2 changes: 1 addition & 1 deletion service/history/queues/slice_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ package queues
import (
"errors"
"math/rand"
"slices"
"testing"
"time"

"github.com/golang/mock/gomock"
"github.com/pborman/uuid"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"
"golang.org/x/exp/slices"

enumsspb "go.temporal.io/server/api/enums/v1"
"go.temporal.io/server/common/clock"
Expand Down
3 changes: 1 addition & 2 deletions service/history/queues/test_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,9 @@ package queues
import (
"math"
"math/rand"
"slices"
"time"

"golang.org/x/exp/slices"

"go.temporal.io/server/common/predicates"
"go.temporal.io/server/service/history/tasks"
)
Expand Down
2 changes: 1 addition & 1 deletion service/history/tasks/predicates_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@
package tasks

import (
"slices"
"testing"

"github.com/golang/mock/gomock"
"github.com/pborman/uuid"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"
"golang.org/x/exp/rand"
"golang.org/x/exp/slices"

enumsspb "go.temporal.io/server/api/enums/v1"
"go.temporal.io/server/api/persistence/v1"
Expand Down
Loading

0 comments on commit 9492ff4

Please sign in to comment.