diff --git a/internal/cmd/certificate/list.go b/internal/cmd/certificate/list.go index b13e5e22..5ea4e4e1 100644 --- a/internal/cmd/certificate/list.go +++ b/internal/cmd/certificate/list.go @@ -79,7 +79,7 @@ var ListCmd = base.ListCmd{ }, JSONSchema: func(resources []interface{}) interface{} { - var certSchemas []schema.Certificate + certSchemas := make([]schema.Certificate, 0, len(resources)) for _, resource := range resources { cert := resource.(*hcloud.Certificate) certSchema := schema.Certificate{ diff --git a/internal/cmd/datacenter/list.go b/internal/cmd/datacenter/list.go index e8ba19f6..e4b2706e 100644 --- a/internal/cmd/datacenter/list.go +++ b/internal/cmd/datacenter/list.go @@ -40,7 +40,7 @@ var ListCmd = base.ListCmd{ }, JSONSchema: func(resources []interface{}) interface{} { - var dcSchemas []schema.Datacenter + dcSchemas := make([]schema.Datacenter, 0, len(resources)) for _, resource := range resources { dc := resource.(*hcloud.Datacenter) dcSchemas = append(dcSchemas, util.DatacenterToSchema(*dc)) diff --git a/internal/cmd/firewall/list.go b/internal/cmd/firewall/list.go index 34ad63f2..a3bc31d3 100644 --- a/internal/cmd/firewall/list.go +++ b/internal/cmd/firewall/list.go @@ -66,7 +66,7 @@ var ListCmd = base.ListCmd{ }, JSONSchema: func(resources []interface{}) interface{} { - var firewallSchemas []schema.Firewall + firewallSchemas := make([]schema.Firewall, 0, len(resources)) for _, resource := range resources { firewall := resource.(*hcloud.Firewall) firewallSchema := schema.Firewall{ diff --git a/internal/cmd/floatingip/list.go b/internal/cmd/floatingip/list.go index 60c7c71f..e19acd7e 100644 --- a/internal/cmd/floatingip/list.go +++ b/internal/cmd/floatingip/list.go @@ -92,7 +92,7 @@ var ListCmd = base.ListCmd{ }, JSONSchema: func(resources []interface{}) interface{} { - var floatingIPSchemas []schema.FloatingIP + floatingIPSchemas := make([]schema.FloatingIP, 0, len(resources)) for _, resource := range resources { floatingIP := resource.(*hcloud.FloatingIP) floatingIPSchema := schema.FloatingIP{ diff --git a/internal/cmd/image/list.go b/internal/cmd/image/list.go index 84538594..0d3e396c 100644 --- a/internal/cmd/image/list.go +++ b/internal/cmd/image/list.go @@ -141,7 +141,7 @@ var ListCmd = base.ListCmd{ }, JSONSchema: func(resources []interface{}) interface{} { - var imageSchemas []schema.Image + imageSchemas := make([]schema.Image, 0, len(resources)) for _, resource := range resources { image := resource.(*hcloud.Image) imageSchemas = append(imageSchemas, util.ImageToSchema(*image)) diff --git a/internal/cmd/iso/list.go b/internal/cmd/iso/list.go index 94319aca..16bcf759 100644 --- a/internal/cmd/iso/list.go +++ b/internal/cmd/iso/list.go @@ -90,7 +90,7 @@ var ListCmd = base.ListCmd{ }, JSONSchema: func(resources []interface{}) interface{} { - var isoSchemas []schema.ISO + isoSchemas := make([]schema.ISO, 0, len(resources)) for _, resource := range resources { iso := resource.(*hcloud.ISO) isoSchemas = append(isoSchemas, util.ISOToSchema(*iso)) diff --git a/internal/cmd/loadbalancer/list.go b/internal/cmd/loadbalancer/list.go index c4d15ec3..b49d74b2 100644 --- a/internal/cmd/loadbalancer/list.go +++ b/internal/cmd/loadbalancer/list.go @@ -83,7 +83,7 @@ var ListCmd = base.ListCmd{ }, JSONSchema: func(resources []interface{}) interface{} { - var loadBalancerSchemas []schema.LoadBalancer + loadBalancerSchemas := make([]schema.LoadBalancer, 0, len(resources)) for _, resource := range resources { loadBalancer := resource.(*hcloud.LoadBalancer) loadBalancerSchema := schema.LoadBalancer{ diff --git a/internal/cmd/loadbalancertype/list.go b/internal/cmd/loadbalancertype/list.go index 049325ad..d22d4a97 100644 --- a/internal/cmd/loadbalancertype/list.go +++ b/internal/cmd/loadbalancertype/list.go @@ -38,7 +38,7 @@ var ListCmd = base.ListCmd{ }, JSONSchema: func(resources []interface{}) interface{} { - var loadBalancerTypeSchemas []schema.LoadBalancerType + loadBalancerTypeSchemas := make([]schema.LoadBalancerType, 0, len(resources)) for _, resource := range resources { loadBalancerType := resource.(*hcloud.LoadBalancerType) loadBalancerTypeSchemas = append(loadBalancerTypeSchemas, util.LoadBalancerTypeToSchema(*loadBalancerType)) diff --git a/internal/cmd/location/list.go b/internal/cmd/location/list.go index cf2897d1..a486a6ff 100644 --- a/internal/cmd/location/list.go +++ b/internal/cmd/location/list.go @@ -37,7 +37,7 @@ var ListCmd = base.ListCmd{ }, JSONSchema: func(resources []interface{}) interface{} { - var locationSchemas []schema.Location + locationSchemas := make([]schema.Location, 0, len(resources)) for _, resource := range resources { location := resource.(*hcloud.Location) locationSchemas = append(locationSchemas, util.LocationToSchema(*location)) diff --git a/internal/cmd/network/list.go b/internal/cmd/network/list.go index b89fdb55..01c32255 100644 --- a/internal/cmd/network/list.go +++ b/internal/cmd/network/list.go @@ -70,9 +70,8 @@ var ListCmd = base.ListCmd{ return util.Age(network.Created, time.Now()) })) }, - JSONSchema: func(resources []interface{}) interface{} { - var networkSchemas []schema.Network + networkSchemas := make([]schema.Network, 0, len(resources)) for _, resource := range resources { network := resource.(*hcloud.Network) diff --git a/internal/cmd/placementgroup/list.go b/internal/cmd/placementgroup/list.go index 8df44e1e..0df5fa3e 100644 --- a/internal/cmd/placementgroup/list.go +++ b/internal/cmd/placementgroup/list.go @@ -55,7 +55,7 @@ var ListCmd = base.ListCmd{ }, JSONSchema: func(resources []interface{}) interface{} { - var placementGroupSchemas []schema.PlacementGroup + placementGroupSchemas := make([]schema.PlacementGroup, 0, len(resources)) for _, resource := range resources { placementGroup := resource.(*hcloud.PlacementGroup) placementGroupSchema := schema.PlacementGroup{ diff --git a/internal/cmd/primaryip/list.go b/internal/cmd/primaryip/list.go index 5374ad64..8b31006b 100644 --- a/internal/cmd/primaryip/list.go +++ b/internal/cmd/primaryip/list.go @@ -88,7 +88,7 @@ var ListCmd = base.ListCmd{ }, JSONSchema: func(resources []interface{}) interface{} { - var primaryIPsSchema []schema.PrimaryIP + primaryIPsSchema := make([]schema.PrimaryIP, 0, len(resources)) for _, resource := range resources { primaryIP := resource.(*hcloud.PrimaryIP) var dnsPtrs []hcloud.PrimaryIPDNSPTR diff --git a/internal/cmd/server/list.go b/internal/cmd/server/list.go index f325f03d..c6502028 100644 --- a/internal/cmd/server/list.go +++ b/internal/cmd/server/list.go @@ -128,7 +128,7 @@ var ListCmd = base.ListCmd{ }, JSONSchema: func(resources []interface{}) interface{} { - var serversSchema []schema.Server + serversSchema := make([]schema.Server, 0, len(resources)) for _, resource := range resources { server := resource.(*hcloud.Server) diff --git a/internal/cmd/servertype/list.go b/internal/cmd/servertype/list.go index 2af76d32..f8a5e2cf 100644 --- a/internal/cmd/servertype/list.go +++ b/internal/cmd/servertype/list.go @@ -52,7 +52,7 @@ var ListCmd = base.ListCmd{ }, JSONSchema: func(resources []interface{}) interface{} { - var serverTypeSchemas []schema.ServerType + serverTypeSchemas := make([]schema.ServerType, 0, len(resources)) for _, resource := range resources { serverType := resource.(*hcloud.ServerType) serverTypeSchemas = append(serverTypeSchemas, util.ServerTypeToSchema(*serverType)) diff --git a/internal/cmd/sshkey/list.go b/internal/cmd/sshkey/list.go index 47376dd3..6e49d0d5 100644 --- a/internal/cmd/sshkey/list.go +++ b/internal/cmd/sshkey/list.go @@ -50,7 +50,7 @@ var ListCmd = base.ListCmd{ }, JSONSchema: func(resources []interface{}) interface{} { - var sshKeySchemas []schema.SSHKey + sshKeySchemas := make([]schema.SSHKey, 0, len(resources)) for _, resource := range resources { sshKey := resource.(*hcloud.SSHKey) sshKeySchema := schema.SSHKey{ diff --git a/internal/cmd/volume/list.go b/internal/cmd/volume/list.go index 509b0c2d..e152a478 100644 --- a/internal/cmd/volume/list.go +++ b/internal/cmd/volume/list.go @@ -76,7 +76,7 @@ var ListCmd = base.ListCmd{ }, JSONSchema: func(resources []interface{}) interface{} { - var volumesSchema []schema.Volume + volumesSchema := make([]schema.Volume, 0, len(resources)) for _, resource := range resources { volume := resource.(*hcloud.Volume) volumeSchema := schema.Volume{