diff options
author | MalloZup <dmaiocchi@suse.com> | 2017-11-17 11:54:11 +0100 |
---|---|---|
committer | MalloZup <dmaiocchi@suse.com> | 2017-11-17 12:41:54 +0100 |
commit | 5b215d3b86f285045fc5966de5d6ec3bf2f095da (patch) | |
tree | dd4e8aa0e4563e436cf9a45b40fad2629429dcf5 | |
parent | 03b52b7f1c82bbfa3291b6517aaebdb8dd5ae2d1 (diff) | |
download | terraform-provider-libvirt-5b215d3b86f285045fc5966de5d6ec3bf2f095da.tar terraform-provider-libvirt-5b215d3b86f285045fc5966de5d6ec3bf2f095da.tar.gz |
don't allocate memory with 0 make variables
-rw-r--r-- | libvirt/resource_libvirt_domain.go | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/libvirt/resource_libvirt_domain.go b/libvirt/resource_libvirt_domain.go index 521e16de..6e8830b4 100644 --- a/libvirt/resource_libvirt_domain.go +++ b/libvirt/resource_libvirt_domain.go @@ -868,7 +868,7 @@ func resourceLibvirtDomainRead(d *schema.ResourceData, meta interface{}) error { } d.Set("running", running) - disks := make([]map[string]interface{}, 0) + var disks []map[string]interface{} for _, diskDef := range domainDef.Devices.Disks { var virVol *libvirt.StorageVol if len(diskDef.Source.File) > 0 { @@ -899,8 +899,7 @@ func resourceLibvirtDomainRead(d *schema.ResourceData, meta interface{}) error { disks = append(disks, disk) } d.Set("disks", disks) - - filesystems := make([]map[string]interface{}, 0) + var filesystems []map[string]interface{} for _, fsDef := range domainDef.Devices.Filesystems { fs := map[string]interface{}{ "accessmode": fsDef.AccessMode, @@ -921,7 +920,7 @@ func resourceLibvirtDomainRead(d *schema.ResourceData, meta interface{}) error { addressesForMac := func(mac string) []string { // look for an ip address and try to match it with the mac address // not sure if using the target device name is a better idea here - addrs := make([]string, 0) + var addrs []string for _, ifaceWithAddr := range ifacesWithAddr { if strings.ToUpper(ifaceWithAddr.Hwaddr) == mac { for _, addr := range ifaceWithAddr.Addrs { @@ -932,7 +931,7 @@ func resourceLibvirtDomainRead(d *schema.ResourceData, meta interface{}) error { return addrs } - netIfaces := make([]map[string]interface{}, 0) + var netIfaces []map[string]interface{} for i, networkInterfaceDef := range domainDef.Devices.Interfaces { // we need it to read old values prefix := fmt.Sprintf("network_interface.%d", i) |