Skip to content

Commit 49ede20

Browse files
author
Kazuyoshi Kato
committed
refactor: bye golang.org/x/exp
After Go 1.23, the standard library provides what we use from the exp package.
1 parent 76d027c commit 49ede20

14 files changed

Lines changed: 21 additions & 23 deletions

File tree

go.mod

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
module github.com/superfly/flyctl
22

3-
go 1.22.0
4-
5-
toolchain go1.22.6
3+
go 1.23.1
64

75
require (
86
github.com/AlecAivazis/survey/v2 v2.3.7
@@ -84,7 +82,6 @@ require (
8482
go.opentelemetry.io/otel/sdk v1.30.0
8583
go.opentelemetry.io/otel/trace v1.30.0
8684
golang.org/x/crypto v0.27.0
87-
golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa
8885
golang.org/x/mod v0.21.0
8986
golang.org/x/net v0.29.0
9087
golang.org/x/sync v0.8.0
@@ -254,6 +251,7 @@ require (
254251
go.opentelemetry.io/otel/metric v1.30.0 // indirect
255252
go.opentelemetry.io/proto/otlp v1.3.1 // indirect
256253
go.uber.org/multierr v1.11.0 // indirect
254+
golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa // indirect
257255
golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 // indirect
258256
golang.org/x/oauth2 v0.22.0 // indirect
259257
golang.org/x/tools v0.24.0 // indirect

internal/command/command_run.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"os"
1010
"path"
1111
"path/filepath"
12+
"slices"
1213
"strconv"
1314
"strings"
1415

@@ -17,7 +18,6 @@ import (
1718
"github.com/samber/lo"
1819
fly "github.com/superfly/fly-go"
1920
"github.com/superfly/flyctl/iostreams"
20-
"golang.org/x/exp/slices"
2121

2222
"github.com/superfly/flyctl/internal/appconfig"
2323
"github.com/superfly/flyctl/internal/build/imgsrc"

internal/command/deploy/machines.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"encoding/json"
66
"fmt"
7+
"maps"
78
"slices"
89
"strings"
910
"sync"
@@ -26,7 +27,6 @@ import (
2627
"github.com/superfly/flyctl/terminal"
2728
"go.opentelemetry.io/otel/attribute"
2829
"go.opentelemetry.io/otel/trace"
29-
"golang.org/x/exp/maps"
3030
)
3131

3232
const (
@@ -404,7 +404,7 @@ func (md *machineDeployment) setMachinesForDeployment(ctx context.Context) error
404404
s = "s"
405405
}
406406

407-
filtersAppliedStr := strings.Join(maps.Keys(filtersApplied), "/")
407+
filtersAppliedStr := strings.Join(slices.Collect(maps.Keys(filtersApplied)), "/")
408408

409409
fmt.Fprintf(md.io.ErrOut, "%s filter%s applied, deploying to %d/%d machines\n", filtersAppliedStr, s, len(machines), nMachines)
410410
}

internal/command/deploy/machines_deploymachinesapp.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"context"
66
"errors"
77
"fmt"
8+
"maps"
89
"math"
910
"net"
1011
"slices"
@@ -31,7 +32,6 @@ import (
3132
"github.com/superfly/flyctl/terminal"
3233
"go.opentelemetry.io/otel/attribute"
3334
"go.opentelemetry.io/otel/trace"
34-
"golang.org/x/exp/maps"
3535
"golang.org/x/sync/errgroup"
3636
)
3737

@@ -281,9 +281,8 @@ func (md *machineDeployment) deployCanaryMachines(ctx context.Context) (err erro
281281
func (md *machineDeployment) deployCreateMachinesForGroups(ctx context.Context, processGroupMachineDiff ProcessGroupsDiff) (err error) {
282282
groupsWithAutostopEnabled := make(map[string]bool)
283283
groupsWithAutosuspendEnabled := make(map[string]bool)
284-
groups := maps.Keys(processGroupMachineDiff.groupsNeedingMachines)
284+
groups := slices.Sorted(maps.Keys(processGroupMachineDiff.groupsNeedingMachines))
285285
total := len(groups)
286-
slices.Sort(groups)
287286

288287
sl := statuslogger.Create(ctx, total, true)
289288
defer sl.Destroy(false)

internal/command/platform/regions.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ package platform
33
import (
44
"context"
55
"fmt"
6+
"slices"
67
"sort"
78

89
"github.com/spf13/cobra"
9-
"golang.org/x/exp/slices"
1010

1111
"github.com/superfly/flyctl/iostreams"
1212

internal/command/redis/create.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import (
44
"context"
55
"errors"
66
"fmt"
7+
"slices"
78

89
"github.com/spf13/cobra"
9-
"golang.org/x/exp/slices"
1010

1111
fly "github.com/superfly/fly-go"
1212
"github.com/superfly/flyctl/gql"

internal/command/scale/count.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package scale
33
import (
44
"context"
55
"fmt"
6+
"maps"
67
"slices"
78
"strconv"
89
"strings"
@@ -16,7 +17,6 @@ import (
1617
"github.com/superfly/flyctl/internal/flag"
1718
"github.com/superfly/flyctl/internal/flag/completion"
1819
"github.com/superfly/flyctl/internal/flapsutil"
19-
"golang.org/x/exp/maps"
2020
)
2121

2222
func newScaleCount() *cobra.Command {
@@ -75,7 +75,7 @@ func runScaleCount(ctx context.Context) error {
7575
return err
7676
}
7777

78-
unknownNames := lo.Filter(maps.Keys(groups), func(x string, _ int) bool {
78+
unknownNames := lo.Filter(slices.Collect(maps.Keys(groups)), func(x string, _ int) bool {
7979
return !slices.Contains(processNames, x)
8080
})
8181
if len(unknownNames) > 0 {

internal/command/version/upgrade.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ import (
77
"fmt"
88
"os"
99
"os/exec"
10+
"slices"
1011
"strings"
1112

1213
"github.com/samber/lo"
1314
"github.com/spf13/cobra"
1415
"github.com/superfly/flyctl/terminal"
15-
"golang.org/x/exp/slices"
1616

1717
"github.com/superfly/flyctl/internal/buildinfo"
1818
"github.com/superfly/flyctl/internal/cache"

internal/config/tokens.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"errors"
66
"fmt"
7+
"maps"
78
"slices"
89
"strconv"
910
"sync"
@@ -17,7 +18,6 @@ import (
1718
"github.com/superfly/flyctl/internal/task"
1819
"github.com/superfly/macaroon"
1920
"github.com/superfly/macaroon/flyio"
20-
"golang.org/x/exp/maps"
2121
)
2222

2323
// UserURLCallback is a function that opens a URL in the user's browser. This is
@@ -272,7 +272,7 @@ func doFetchOrgTokens(ctx context.Context, t *tokens.Tokens, fetchOrgs orgFetche
272272
defer wgLock.Unlock()
273273
macToks = append(macToks, m)
274274
}
275-
for _, graphID := range maps.Values(graphIDByNumericID) {
275+
for graphID := range maps.Values(graphIDByNumericID) {
276276
graphID := graphID
277277

278278
wg.Add(1)

internal/haikunator/haikunator.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ import (
44
"crypto/rand"
55
"math/big"
66
rand2 "math/rand"
7+
"slices"
78
"strconv"
89
"strings"
910

1011
"github.com/superfly/flyctl/helpers"
11-
"golang.org/x/exp/slices"
1212
)
1313

1414
var adjectives = strings.Fields(`

0 commit comments

Comments
 (0)