Skip to content

Commit

Permalink
no more samber/lo and allow go-querystring
Browse files Browse the repository at this point in the history
  • Loading branch information
dangra committed Mar 15, 2024
1 parent 25de43d commit e082763
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ linters-settings:
modules:
- github.com/cenkalti/backoff/v4
- github.com/Khan/genqlient
- github.com/google/go-querystring
- github.com/PuerkitoBio/rehttp
- github.com/samber/lo
- github.com/superfly/graphql
- github.com/superfly/macaroon
- github.com/superfly/macaroon/flyio
Expand Down
6 changes: 3 additions & 3 deletions flaps/flaps_machines.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import (
"errors"
"fmt"
"net/http"
"slices"
"time"

"github.com/cenkalti/backoff/v4"
"github.com/google/go-querystring/query"
"github.com/samber/lo"
fly "github.com/superfly/fly-go"
)

Expand Down Expand Up @@ -233,8 +233,8 @@ func (f *Client) ListActive(ctx context.Context) ([]*fly.Machine, error) {
return nil, fmt.Errorf("failed to list active VMs: %w", err)
}

machines = lo.Filter(machines, func(m *fly.Machine, _ int) bool {
return !m.IsReleaseCommandMachine() && !m.IsFlyAppsConsole() && m.IsActive()
machines = slices.DeleteFunc(machines, func(m *fly.Machine) bool {
return m.IsReleaseCommandMachine() || m.IsFlyAppsConsole() || !m.IsActive()
})

return machines, nil
Expand Down
10 changes: 6 additions & 4 deletions flaps/flaps_volumes.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"net/http"
"slices"

"github.com/samber/lo"
fly "github.com/superfly/fly-go"
)

Expand Down Expand Up @@ -35,9 +34,12 @@ func (f *Client) GetVolumes(ctx context.Context) ([]fly.Volume, error) {
if err != nil {
return nil, err
}
return lo.Filter(volumes, func(v fly.Volume, _ int) bool {
return !slices.Contains(destroyedVolumeStates, v.State)
}), nil

volumes = slices.DeleteFunc(volumes, func(v fly.Volume) bool {
return slices.Contains(destroyedVolumeStates, v.State)
})

return volumes, nil
}

func (f *Client) CreateVolume(ctx context.Context, req fly.CreateVolumeRequest) (*fly.Volume, error) {
Expand Down
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ require (
github.com/google/uuid v1.4.0 // indirect
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/samber/lo v1.39.0
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/vektah/gqlparser/v2 v2.5.1 // indirect
github.com/vmihailenco/msgpack/v5 v5.3.5 // indirect
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/samber/lo v1.39.0 h1:4gTz1wUhNYLhFSKl6O+8peW0v2F4BCY034GRpU9WnuA=
github.com/samber/lo v1.39.0/go.mod h1:+m/ZKRl6ClXCE2Lgf3MsQlWfh4bn1bz6CXEOxnEXnEA=
github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
Expand Down

0 comments on commit e082763

Please sign in to comment.