From 108456585d2b5d786ccacb30414f5971e663444a Mon Sep 17 00:00:00 2001 From: "Wiktor W." Date: Sat, 4 Nov 2023 18:08:56 +0100 Subject: [PATCH] chore: use keyed fields with struct literals --- cli/app/remove.go | 2 +- pkg/client/volumes.go | 2 +- pkg/limit/limit.go | 2 +- pkg/upstream/stack/stack.go | 12 ++++++------ 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/cli/app/remove.go b/cli/app/remove.go index ea4efedf..f8e0bfd5 100644 --- a/cli/app/remove.go +++ b/cli/app/remove.go @@ -110,7 +110,7 @@ flag. logrus.Fatal(err) } - volumeListOptions := volume.ListOptions{fs} + volumeListOptions := volume.ListOptions{Filters: fs} volumeListOKBody, err := cl.VolumeList(context.Background(), volumeListOptions) volumeList := volumeListOKBody.Volumes if err != nil { diff --git a/pkg/client/volumes.go b/pkg/client/volumes.go index 4afd60c2..524785d0 100644 --- a/pkg/client/volumes.go +++ b/pkg/client/volumes.go @@ -9,7 +9,7 @@ import ( ) func GetVolumes(cl *client.Client, ctx context.Context, server string, fs filters.Args) ([]*volume.Volume, error) { - volumeListOptions := volume.ListOptions{fs} + volumeListOptions := volume.ListOptions{Filters: fs} volumeListOKBody, err := cl.VolumeList(ctx, volumeListOptions) volumeList := volumeListOKBody.Volumes if err != nil { diff --git a/pkg/limit/limit.go b/pkg/limit/limit.go index 187f9bef..951a34aa 100644 --- a/pkg/limit/limit.go +++ b/pkg/limit/limit.go @@ -6,7 +6,7 @@ type Limiter struct{ sem chan struct{} } // New returns a new Limiter. The limit param is the maximum number of // concurrent operations. func New(limit int) *Limiter { - return &Limiter{make(chan struct{}, limit)} + return &Limiter{sem: make(chan struct{}, limit)} } // Begin an operation. diff --git a/pkg/upstream/stack/stack.go b/pkg/upstream/stack/stack.go index c2d1e214..94821412 100644 --- a/pkg/upstream/stack/stack.go +++ b/pkg/upstream/stack/stack.go @@ -66,19 +66,19 @@ func GetDeployedServicesByLabel(cl *dockerClient.Client, contextName string, lab filters.Add("label", label) services, err := cl.ServiceList(context.Background(), types.ServiceListOptions{Filters: filters}) if err != nil { - return StackStatus{[]swarm.Service{}, err} + return StackStatus{Services: []swarm.Service{}, Err: err} } - return StackStatus{services, nil} + return StackStatus{Services: services, Err: nil} } func GetAllDeployedServices(cl *dockerClient.Client, contextName string) StackStatus { services, err := cl.ServiceList(context.Background(), types.ServiceListOptions{Filters: getAllStacksFilter()}) if err != nil { - return StackStatus{[]swarm.Service{}, err} + return StackStatus{Services: []swarm.Service{}, Err: err} } - return StackStatus{services, nil} + return StackStatus{Services: services, Err: nil} } // GetDeployedServicesByName filters services by name @@ -88,10 +88,10 @@ func GetDeployedServicesByName(ctx context.Context, cl *dockerClient.Client, sta services, err := cl.ServiceList(ctx, types.ServiceListOptions{Filters: filters}) if err != nil { - return StackStatus{[]swarm.Service{}, err} + return StackStatus{Services: []swarm.Service{}, Err: err} } - return StackStatus{services, nil} + return StackStatus{Services: services, Err: nil} } // IsDeployed chekcks whether an appp is deployed or not.