aboutsummaryrefslogtreecommitdiff
path: root/libvirt
diff options
context:
space:
mode:
authorMalloZup <dmaiocchi@suse.com>2017-11-17 11:54:11 +0100
committerDuncan Mac-Vicar P <dmacvicar@suse.de>2017-11-24 17:56:44 +0100
commit8d80cf73c79c5c4bdd15dc28690bb06dfa364f1b (patch)
tree2fa527ca6fa4b238f357a7fb748741ff7be14ff3 /libvirt
parent4bf71329261f27fc6f8c70fbe60910529e8f4a83 (diff)
downloadterraform-provider-libvirt-8d80cf73c79c5c4bdd15dc28690bb06dfa364f1b.tar
terraform-provider-libvirt-8d80cf73c79c5c4bdd15dc28690bb06dfa364f1b.tar.gz
don't allocate memory with 0 make variables
Diffstat (limited to 'libvirt')
-rw-r--r--libvirt/resource_libvirt_domain.go9
1 files changed, 4 insertions, 5 deletions
diff --git a/libvirt/resource_libvirt_domain.go b/libvirt/resource_libvirt_domain.go
index 1925b3ac..a3b16792 100644
--- a/libvirt/resource_libvirt_domain.go
+++ b/libvirt/resource_libvirt_domain.go
@@ -884,7 +884,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 {
// network drives do not have a volume associated
if diskDef.Type == "network" {
@@ -934,8 +934,7 @@ func resourceLibvirtDomainRead(d *schema.ResourceData, meta interface{}) error {
}
}
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,
@@ -956,7 +955,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 {
@@ -967,7 +966,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)