From 4bf71329261f27fc6f8c70fbe60910529e8f4a83 Mon Sep 17 00:00:00 2001 From: Dario Maiocchi Date: Thu, 16 Nov 2017 16:49:53 +0100 Subject: remove duplicata declaration and simplify code. This fix is with the cmd "gofmt -w -s *" --- libvirt/resource_libvirt_domain.go | 46 +++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 23 deletions(-) (limited to 'libvirt/resource_libvirt_domain.go') diff --git a/libvirt/resource_libvirt_domain.go b/libvirt/resource_libvirt_domain.go index 7266923b..1925b3ac 100644 --- a/libvirt/resource_libvirt_domain.go +++ b/libvirt/resource_libvirt_domain.go @@ -46,58 +46,58 @@ func resourceLibvirtDomain() *schema.Resource { Create: schema.DefaultTimeout(5 * time.Minute), }, Schema: map[string]*schema.Schema{ - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Required: true, ForceNew: true, }, - "metadata": &schema.Schema{ + "metadata": { Type: schema.TypeString, Required: false, Optional: true, ForceNew: false, }, - "vcpu": &schema.Schema{ + "vcpu": { Type: schema.TypeInt, Optional: true, Default: 1, ForceNew: true, }, - "memory": &schema.Schema{ + "memory": { Type: schema.TypeInt, Optional: true, Default: 512, ForceNew: true, }, - "firmware": &schema.Schema{ + "firmware": { Type: schema.TypeString, Optional: true, ForceNew: true, }, - "nvram": &schema.Schema{ + "nvram": { Type: schema.TypeMap, Optional: true, ForceNew: true, }, - "running": &schema.Schema{ + "running": { Type: schema.TypeBool, Optional: true, Default: true, ForceNew: false, }, - "cloudinit": &schema.Schema{ + "cloudinit": { Type: schema.TypeString, Required: false, Optional: true, ForceNew: false, }, - "coreos_ignition": &schema.Schema{ + "coreos_ignition": { Type: schema.TypeString, Optional: true, ForceNew: true, Default: "", }, - "filesystem": &schema.Schema{ + "filesystem": { Type: schema.TypeList, Optional: true, Required: false, @@ -106,7 +106,7 @@ func resourceLibvirtDomain() *schema.Resource { Type: schema.TypeMap, }, }, - "disk": &schema.Schema{ + "disk": { Type: schema.TypeList, Optional: true, Required: false, @@ -115,7 +115,7 @@ func resourceLibvirtDomain() *schema.Resource { Type: schema.TypeMap, }, }, - "network_interface": &schema.Schema{ + "network_interface": { Type: schema.TypeList, Optional: true, Required: false, @@ -123,12 +123,12 @@ func resourceLibvirtDomain() *schema.Resource { Schema: networkInterfaceCommonSchema(), }, }, - "graphics": &schema.Schema{ + "graphics": { Type: schema.TypeMap, Optional: true, Required: false, }, - "console": &schema.Schema{ + "console": { Type: schema.TypeList, Optional: true, Required: false, @@ -136,28 +136,28 @@ func resourceLibvirtDomain() *schema.Resource { Schema: consoleSchema(), }, }, - "cpu": &schema.Schema{ + "cpu": { Type: schema.TypeMap, Optional: true, Required: false, ForceNew: true, }, - "autostart": &schema.Schema{ + "autostart": { Type: schema.TypeBool, Optional: true, Required: false, }, - "machine": &schema.Schema{ + "machine": { Type: schema.TypeString, Optional: true, Default: "pc", }, - "arch": &schema.Schema{ + "arch": { Type: schema.TypeString, Optional: true, Default: "x86_64", }, - "boot_device": &schema.Schema{ + "boot_device": { Type: schema.TypeList, Optional: true, Required: false, @@ -165,7 +165,7 @@ func resourceLibvirtDomain() *schema.Resource { Schema: bootDeviceSchema(), }, }, - "emulator": &schema.Schema{ + "emulator": { Type: schema.TypeString, Default: "/usr/bin/qemu-system-x86_64", Optional: true, @@ -176,7 +176,7 @@ func resourceLibvirtDomain() *schema.Resource { func bootDeviceSchema() map[string]*schema.Schema { return map[string]*schema.Schema{ - "dev": &schema.Schema{ + "dev": { Type: schema.TypeList, Optional: true, Required: false, @@ -249,7 +249,7 @@ func resourceLibvirtDomainCreate(d *schema.ResourceData, meta interface{}) error if graphics, ok := d.GetOk("graphics"); ok { graphicsMap := graphics.(map[string]interface{}) domainDef.Devices.Graphics = []libvirtxml.DomainGraphic{ - libvirtxml.DomainGraphic{}, + {}, } if graphicsType, ok := graphicsMap["type"]; ok { domainDef.Devices.Graphics[0].Type = graphicsType.(string) @@ -259,7 +259,7 @@ func resourceLibvirtDomainCreate(d *schema.ResourceData, meta interface{}) error } if listenType, ok := graphicsMap["listen_type"]; ok { domainDef.Devices.Graphics[0].Listeners = []libvirtxml.DomainGraphicListener{ - libvirtxml.DomainGraphicListener{ + { Type: listenType.(string), }, } -- cgit v1.2.3