Skip to content

Commit 04c3396

Browse files
authored
refactor: replace golang.org/x/exp/slices with slices (coder#16772)
The experimental functions in `golang.org/x/exp/slices` are now available in the standard library since Go 1.21. Reference: https://go.dev/doc/go1.21#slices Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
1 parent 88f0131 commit 04c3396

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+53
-55
lines changed

agent/agent.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
"os"
1515
"os/user"
1616
"path/filepath"
17+
"slices"
1718
"sort"
1819
"strconv"
1920
"strings"
@@ -26,7 +27,6 @@ import (
2627
"github.com/prometheus/common/expfmt"
2728
"github.com/spf13/afero"
2829
"go.uber.org/atomic"
29-
"golang.org/x/exp/slices"
3030
"golang.org/x/sync/errgroup"
3131
"golang.org/x/xerrors"
3232
"google.golang.org/protobuf/types/known/timestamppb"

agent/agent_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import (
1919
"path/filepath"
2020
"regexp"
2121
"runtime"
22+
"slices"
2223
"strconv"
2324
"strings"
2425
"sync/atomic"
@@ -41,7 +42,6 @@ import (
4142
"github.com/stretchr/testify/assert"
4243
"github.com/stretchr/testify/require"
4344
"golang.org/x/crypto/ssh"
44-
"golang.org/x/exp/slices"
4545
"golang.org/x/xerrors"
4646

4747
"cdr.dev/slog"

agent/agentssh/agentssh.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"os/user"
1313
"path/filepath"
1414
"runtime"
15+
"slices"
1516
"strings"
1617
"sync"
1718
"time"
@@ -24,7 +25,6 @@ import (
2425
"github.com/spf13/afero"
2526
"go.uber.org/atomic"
2627
gossh "golang.org/x/crypto/ssh"
27-
"golang.org/x/exp/slices"
2828
"golang.org/x/xerrors"
2929

3030
"cdr.dev/slog"

agent/agenttest/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package agenttest
33
import (
44
"context"
55
"io"
6+
"slices"
67
"sync"
78
"sync/atomic"
89
"testing"
@@ -12,7 +13,6 @@ import (
1213
"github.com/stretchr/testify/assert"
1314
"github.com/stretchr/testify/require"
1415
"golang.org/x/exp/maps"
15-
"golang.org/x/exp/slices"
1616
"golang.org/x/xerrors"
1717
"google.golang.org/protobuf/types/known/durationpb"
1818
"google.golang.org/protobuf/types/known/emptypb"

agent/reconnectingpty/buffered.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ import (
55
"errors"
66
"io"
77
"net"
8+
"slices"
89
"time"
910

1011
"github.com/armon/circbuf"
1112
"github.com/prometheus/client_golang/prometheus"
12-
"golang.org/x/exp/slices"
1313
"golang.org/x/xerrors"
1414

1515
"cdr.dev/slog"

cli/configssh.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"os"
1212
"path/filepath"
1313
"runtime"
14+
"slices"
1415
"strconv"
1516
"strings"
1617

@@ -19,7 +20,6 @@ import (
1920
"github.com/pkg/diff"
2021
"github.com/pkg/diff/write"
2122
"golang.org/x/exp/constraints"
22-
"golang.org/x/exp/slices"
2323
"golang.org/x/xerrors"
2424

2525
"github.com/coder/coder/v2/cli/cliui"

cli/create.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ import (
44
"context"
55
"fmt"
66
"io"
7+
"slices"
78
"strings"
89
"time"
910

1011
"github.com/google/uuid"
11-
"golang.org/x/exp/slices"
1212
"golang.org/x/xerrors"
1313

1414
"github.com/coder/pretty"

cli/exp_scaletest.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"net/url"
1313
"os"
1414
"os/signal"
15+
"slices"
1516
"strconv"
1617
"strings"
1718
"sync"
@@ -21,7 +22,6 @@ import (
2122
"github.com/prometheus/client_golang/prometheus"
2223
"github.com/prometheus/client_golang/prometheus/promhttp"
2324
"go.opentelemetry.io/otel/trace"
24-
"golang.org/x/exp/slices"
2525
"golang.org/x/xerrors"
2626

2727
"cdr.dev/slog"

cli/root.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717
"path/filepath"
1818
"runtime"
1919
"runtime/trace"
20+
"slices"
2021
"strings"
2122
"sync"
2223
"syscall"
@@ -25,7 +26,6 @@ import (
2526

2627
"github.com/mattn/go-isatty"
2728
"github.com/mitchellh/go-wordwrap"
28-
"golang.org/x/exp/slices"
2929
"golang.org/x/mod/semver"
3030
"golang.org/x/xerrors"
3131

cli/tokens.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ package cli
33
import (
44
"fmt"
55
"os"
6+
"slices"
67
"strings"
78
"time"
89

9-
"golang.org/x/exp/slices"
1010
"golang.org/x/xerrors"
1111

1212
"github.com/coder/coder/v2/cli/cliui"

0 commit comments

Comments
 (0)