diff --git a/hcloud/action.go b/hcloud/action.go index e4cf712b..81b31879 100644 --- a/hcloud/action.go +++ b/hcloud/action.go @@ -145,7 +145,7 @@ func (c *ActionClient) All(ctx context.Context) ([]*Action, error) { // AllWithOpts returns all actions for the given options. func (c *ActionClient) AllWithOpts(ctx context.Context, opts ActionListOpts) ([]*Action, error) { - var allActions []*Action + allActions := []*Action{} err := c.client.all(func(page int) (*Response, error) { opts.Page = page diff --git a/hcloud/certificate.go b/hcloud/certificate.go index 3251cb7f..3d9dbddd 100644 --- a/hcloud/certificate.go +++ b/hcloud/certificate.go @@ -182,7 +182,7 @@ func (c *CertificateClient) All(ctx context.Context) ([]*Certificate, error) { // AllWithOpts returns all Certificates for the given options. func (c *CertificateClient) AllWithOpts(ctx context.Context, opts CertificateListOpts) ([]*Certificate, error) { - var allCertificates []*Certificate + allCertificates := []*Certificate{} err := c.client.all(func(page int) (*Response, error) { opts.Page = page diff --git a/hcloud/datacenter.go b/hcloud/datacenter.go index b899eec3..b1fc1c1e 100644 --- a/hcloud/datacenter.go +++ b/hcloud/datacenter.go @@ -116,7 +116,7 @@ func (c *DatacenterClient) All(ctx context.Context) ([]*Datacenter, error) { // AllWithOpts returns all datacenters for the given options. func (c *DatacenterClient) AllWithOpts(ctx context.Context, opts DatacenterListOpts) ([]*Datacenter, error) { - var allDatacenters []*Datacenter + allDatacenters := []*Datacenter{} err := c.client.all(func(page int) (*Response, error) { opts.Page = page diff --git a/hcloud/firewall.go b/hcloud/firewall.go index f0326e35..509b4b60 100644 --- a/hcloud/firewall.go +++ b/hcloud/firewall.go @@ -180,7 +180,7 @@ func (c *FirewallClient) All(ctx context.Context) ([]*Firewall, error) { // AllWithOpts returns all Firewalls for the given options. func (c *FirewallClient) AllWithOpts(ctx context.Context, opts FirewallListOpts) ([]*Firewall, error) { - var allFirewalls []*Firewall + allFirewalls := []*Firewall{} err := c.client.all(func(page int) (*Response, error) { opts.Page = page diff --git a/hcloud/floating_ip.go b/hcloud/floating_ip.go index 924dabbf..7abba08a 100644 --- a/hcloud/floating_ip.go +++ b/hcloud/floating_ip.go @@ -181,7 +181,7 @@ func (c *FloatingIPClient) All(ctx context.Context) ([]*FloatingIP, error) { // AllWithOpts returns all Floating IPs for the given options. func (c *FloatingIPClient) AllWithOpts(ctx context.Context, opts FloatingIPListOpts) ([]*FloatingIP, error) { - var allFloatingIPs []*FloatingIP + allFloatingIPs := []*FloatingIP{} err := c.client.all(func(page int) (*Response, error) { opts.Page = page diff --git a/hcloud/iso.go b/hcloud/iso.go index 9342786d..c8938468 100644 --- a/hcloud/iso.go +++ b/hcloud/iso.go @@ -143,7 +143,7 @@ func (c *ISOClient) All(ctx context.Context) ([]*ISO, error) { // AllWithOpts returns all ISOs for the given options. func (c *ISOClient) AllWithOpts(ctx context.Context, opts ISOListOpts) ([]*ISO, error) { - allISOs := make([]*ISO, 0) + allISOs := []*ISO{} err := c.client.all(func(page int) (*Response, error) { opts.Page = page diff --git a/hcloud/load_balancer.go b/hcloud/load_balancer.go index 12483183..96d2c81f 100644 --- a/hcloud/load_balancer.go +++ b/hcloud/load_balancer.go @@ -327,7 +327,7 @@ func (c *LoadBalancerClient) All(ctx context.Context) ([]*LoadBalancer, error) { // AllWithOpts returns all Load Balancers for the given options. func (c *LoadBalancerClient) AllWithOpts(ctx context.Context, opts LoadBalancerListOpts) ([]*LoadBalancer, error) { - var allLoadBalancers []*LoadBalancer + allLoadBalancers := []*LoadBalancer{} err := c.client.all(func(page int) (*Response, error) { opts.Page = page diff --git a/hcloud/load_balancer_type.go b/hcloud/load_balancer_type.go index 29daf980..40e37913 100644 --- a/hcloud/load_balancer_type.go +++ b/hcloud/load_balancer_type.go @@ -113,7 +113,7 @@ func (c *LoadBalancerTypeClient) All(ctx context.Context) ([]*LoadBalancerType, // AllWithOpts returns all Load Balancer types for the given options. func (c *LoadBalancerTypeClient) AllWithOpts(ctx context.Context, opts LoadBalancerTypeListOpts) ([]*LoadBalancerType, error) { - var allLoadBalancerTypes []*LoadBalancerType + allLoadBalancerTypes := []*LoadBalancerType{} err := c.client.all(func(page int) (*Response, error) { opts.Page = page diff --git a/hcloud/location.go b/hcloud/location.go index a0b81d94..bd5eb798 100644 --- a/hcloud/location.go +++ b/hcloud/location.go @@ -113,7 +113,7 @@ func (c *LocationClient) All(ctx context.Context) ([]*Location, error) { // AllWithOpts returns all locations for the given options. func (c *LocationClient) AllWithOpts(ctx context.Context, opts LocationListOpts) ([]*Location, error) { - var allLocations []*Location + allLocations := []*Location{} err := c.client.all(func(page int) (*Response, error) { opts.Page = page diff --git a/hcloud/network.go b/hcloud/network.go index 57b16e5b..ba0aef47 100644 --- a/hcloud/network.go +++ b/hcloud/network.go @@ -162,7 +162,7 @@ func (c *NetworkClient) All(ctx context.Context) ([]*Network, error) { // AllWithOpts returns all networks for the given options. func (c *NetworkClient) AllWithOpts(ctx context.Context, opts NetworkListOpts) ([]*Network, error) { - var allNetworks []*Network + allNetworks := []*Network{} err := c.client.all(func(page int) (*Response, error) { opts.Page = page diff --git a/hcloud/placement_group.go b/hcloud/placement_group.go index acf95b6d..5ad3515e 100644 --- a/hcloud/placement_group.go +++ b/hcloud/placement_group.go @@ -133,7 +133,7 @@ func (c *PlacementGroupClient) All(ctx context.Context) ([]*PlacementGroup, erro // AllWithOpts returns all PlacementGroups for the given options. func (c *PlacementGroupClient) AllWithOpts(ctx context.Context, opts PlacementGroupListOpts) ([]*PlacementGroup, error) { - var allPlacementGroups []*PlacementGroup + allPlacementGroups := []*PlacementGroup{} err := c.client.all(func(page int) (*Response, error) { opts.Page = page diff --git a/hcloud/primary_ip.go b/hcloud/primary_ip.go index a1a82f11..631e44a6 100644 --- a/hcloud/primary_ip.go +++ b/hcloud/primary_ip.go @@ -265,7 +265,7 @@ func (c *PrimaryIPClient) All(ctx context.Context) ([]*PrimaryIP, error) { // AllWithOpts returns all Primary IPs for the given options. func (c *PrimaryIPClient) AllWithOpts(ctx context.Context, opts PrimaryIPListOpts) ([]*PrimaryIP, error) { - var allPrimaryIPs []*PrimaryIP + allPrimaryIPs := []*PrimaryIP{} err := c.client.all(func(page int) (*Response, error) { opts.Page = page diff --git a/hcloud/server_type.go b/hcloud/server_type.go index 6fc7c168..029fe1ff 100644 --- a/hcloud/server_type.go +++ b/hcloud/server_type.go @@ -140,7 +140,7 @@ func (c *ServerTypeClient) All(ctx context.Context) ([]*ServerType, error) { // AllWithOpts returns all server types for the given options. func (c *ServerTypeClient) AllWithOpts(ctx context.Context, opts ServerTypeListOpts) ([]*ServerType, error) { - var allServerTypes []*ServerType + allServerTypes := []*ServerType{} err := c.client.all(func(page int) (*Response, error) { opts.Page = page