diff --git a/builtin/providers/aws/network_acl_entry.go b/builtin/providers/aws/network_acl_entry.go index 3d267dcc8..8ce88d81a 100644 --- a/builtin/providers/aws/network_acl_entry.go +++ b/builtin/providers/aws/network_acl_entry.go @@ -1,8 +1,8 @@ package aws import ( - "github.com/mitchellh/goamz/ec2" "fmt" + "github.com/mitchellh/goamz/ec2" ) func expandNetworkAclEntries(configured []interface{}, entryType string) ([]ec2.NetworkAclEntry, error) { @@ -11,7 +11,7 @@ func expandNetworkAclEntries(configured []interface{}, entryType string) ([]ec2. data := eRaw.(map[string]interface{}) protocol := data["protocol"].(string) _, ok := protocolIntegers()[protocol] - if(!ok){ + if !ok { return nil, fmt.Errorf("Invalid Protocol %s for rule %#v", protocol, data) } p := extractProtocolInteger(data["protocol"].(string)) @@ -69,7 +69,7 @@ func protocolIntegers() map[string]int { "udp": 17, "tcp": 6, "icmp": 1, - "all": -1, + "all": -1, } return protocolIntegers } diff --git a/builtin/providers/aws/resource_aws_vpc_test.go b/builtin/providers/aws/resource_aws_vpc_test.go index 2b84ae16c..b555e0875 100644 --- a/builtin/providers/aws/resource_aws_vpc_test.go +++ b/builtin/providers/aws/resource_aws_vpc_test.go @@ -216,4 +216,3 @@ resource "aws_vpc" "bar" { cidr_block = "10.2.0.0/16" } ` - diff --git a/builtin/providers/aws/structure_test.go b/builtin/providers/aws/structure_test.go index 09ae987c8..46d013ef3 100644 --- a/builtin/providers/aws/structure_test.go +++ b/builtin/providers/aws/structure_test.go @@ -297,8 +297,8 @@ func Test_flattenParameters(t *testing.T) { }, Output: []map[string]interface{}{ map[string]interface{}{ - "name": "character_set_client", - "value": "utf8", + "name": "character_set_client", + "value": "utf8", }, }, }, diff --git a/builtin/providers/google/config.go b/builtin/providers/google/config.go index 009f00092..9ae889482 100644 --- a/builtin/providers/google/config.go +++ b/builtin/providers/google/config.go @@ -14,7 +14,6 @@ import ( "golang.org/x/oauth2/jwt" ) - // Config is the configuration structure used to instantiate the Google // provider. type Config struct { diff --git a/builtin/providers/google/image.go b/builtin/providers/google/image.go index 074202283..642b74d9b 100644 --- a/builtin/providers/google/image.go +++ b/builtin/providers/google/image.go @@ -10,7 +10,6 @@ import ( // If it is of the form name then look in the configured project and then hosted image projects. func resolveImage(c *Config, name string) (string, error) { - if strings.HasPrefix(name, "https://www.googleapis.com/compute/v1/") { return name, nil diff --git a/builtin/providers/google/resource_compute_address.go b/builtin/providers/google/resource_compute_address.go index 98aa838c2..d67ceb190 100644 --- a/builtin/providers/google/resource_compute_address.go +++ b/builtin/providers/google/resource_compute_address.go @@ -32,7 +32,6 @@ func resourceComputeAddress() *schema.Resource { Type: schema.TypeString, Computed: true, }, - }, } } diff --git a/builtin/providers/google/resource_compute_forwarding_rule.go b/builtin/providers/google/resource_compute_forwarding_rule.go index 269ff611c..e87374344 100644 --- a/builtin/providers/google/resource_compute_forwarding_rule.go +++ b/builtin/providers/google/resource_compute_forwarding_rule.go @@ -68,12 +68,12 @@ func resourceComputeForwardingRuleCreate(d *schema.ResourceData, meta interface{ config := meta.(*Config) frule := &compute.ForwardingRule{ - IPAddress: d.Get("ip_address").(string), - IPProtocol: d.Get("ip_protocol").(string), + IPAddress: d.Get("ip_address").(string), + IPProtocol: d.Get("ip_protocol").(string), Description: d.Get("description").(string), - Name: d.Get("name").(string), - PortRange: d.Get("port_range").(string), - Target: d.Get("target").(string), + Name: d.Get("name").(string), + PortRange: d.Get("port_range").(string), + Target: d.Get("target").(string), } log.Printf("[DEBUG] ForwardingRule insert request: %#v", frule) @@ -216,4 +216,3 @@ func resourceComputeForwardingRuleDelete(d *schema.ResourceData, meta interface{ d.SetId("") return nil } - diff --git a/builtin/providers/google/resource_compute_forwarding_rule_test.go b/builtin/providers/google/resource_compute_forwarding_rule_test.go index c3aa365df..ee0a00056 100644 --- a/builtin/providers/google/resource_compute_forwarding_rule_test.go +++ b/builtin/providers/google/resource_compute_forwarding_rule_test.go @@ -122,4 +122,3 @@ resource "google_compute_forwarding_rule" "foobar" { target = "${google_compute_target_pool.foobar-tp.self_link}" } ` - diff --git a/builtin/providers/google/resource_compute_instance.go b/builtin/providers/google/resource_compute_instance.go index 020f3de9e..1fb791889 100644 --- a/builtin/providers/google/resource_compute_instance.go +++ b/builtin/providers/google/resource_compute_instance.go @@ -106,7 +106,7 @@ func resourceComputeInstance() *schema.Resource { Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "nat_ip": &schema.Schema{ - Type: schema.TypeString, + Type: schema.TypeString, Computed: true, Optional: true, }, @@ -248,7 +248,6 @@ func resourceOperationWaitZone( return nil } - func resourceComputeInstanceCreate(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) @@ -308,7 +307,6 @@ func resourceComputeInstanceCreate(d *schema.ResourceData, meta interface{}) err if v, ok := d.GetOk(prefix + ".image"); ok { imageName := v.(string) - imageUrl, err := resolveImage(config, imageName) if err != nil { return fmt.Errorf( @@ -557,7 +555,6 @@ func resourceComputeInstanceRead(d *schema.ResourceData, meta interface{}) error internalIP = iface.NetworkIP } - } } @@ -654,7 +651,7 @@ func resourceComputeInstanceUpdate(d *schema.ResourceData, meta interface{}) err for i := 0; i < networkInterfacesCount; i++ { prefix := fmt.Sprintf("network_interface.%d", i) instNetworkInterface := instance.NetworkInterfaces[i] - networkName := d.Get(prefix+".name").(string) + networkName := d.Get(prefix + ".name").(string) // TODO: This sanity check is broken by #929, disabled for now (by forcing the equality) networkName = instNetworkInterface.Name @@ -663,7 +660,7 @@ func resourceComputeInstanceUpdate(d *schema.ResourceData, meta interface{}) err return fmt.Errorf("Instance networkInterface had unexpected name: %s", instNetworkInterface.Name) } - if d.HasChange(prefix+".access_config") { + if d.HasChange(prefix + ".access_config") { // TODO: This code deletes then recreates accessConfigs. This is bad because it may // leave the machine inaccessible from either ip if the creation part fails (network @@ -672,9 +669,9 @@ func resourceComputeInstanceUpdate(d *schema.ResourceData, meta interface{}) err // necessary, and also add before removing. // Delete any accessConfig that currently exists in instNetworkInterface - for _, ac := range(instNetworkInterface.AccessConfigs) { + for _, ac := range instNetworkInterface.AccessConfigs { op, err := config.clientCompute.Instances.DeleteAccessConfig( - config.Project, zone, d.Id(), networkName, ac.Name).Do(); + config.Project, zone, d.Id(), networkName, ac.Name).Do() if err != nil { return fmt.Errorf("Error deleting old access_config: %s", err) } @@ -693,7 +690,7 @@ func resourceComputeInstanceUpdate(d *schema.ResourceData, meta interface{}) err NatIP: d.Get(acPrefix + ".nat_ip").(string), } op, err := config.clientCompute.Instances.AddAccessConfig( - config.Project, zone, d.Id(), networkName, ac).Do(); + config.Project, zone, d.Id(), networkName, ac).Do() if err != nil { return fmt.Errorf("Error adding new access_config: %s", err) } diff --git a/builtin/providers/google/resource_compute_target_pool.go b/builtin/providers/google/resource_compute_target_pool.go index bbf095900..98935b84c 100644 --- a/builtin/providers/google/resource_compute_target_pool.go +++ b/builtin/providers/google/resource_compute_target_pool.go @@ -72,11 +72,11 @@ func resourceComputeTargetPool() *schema.Resource { } func convertStringArr(ifaceArr []interface{}) []string { - arr := make([]string, len(ifaceArr)) - for i, v := range ifaceArr { - arr[i] = v.(string) - } - return arr + arr := make([]string, len(ifaceArr)) + for i, v := range ifaceArr { + arr[i] = v.(string) + } + return arr } func waitOp(config *Config, op *compute.Operation, @@ -151,11 +151,11 @@ func resourceComputeTargetPoolCreate(d *schema.ResourceData, meta interface{}) e // Build the parameter tpool := &compute.TargetPool{ - BackupPool: d.Get("backup_pool").(string), - Description: d.Get("description").(string), - HealthChecks: hchkUrls, - Instances: instanceUrls, - Name: d.Get("name").(string), + BackupPool: d.Get("backup_pool").(string), + Description: d.Get("description").(string), + HealthChecks: hchkUrls, + Instances: instanceUrls, + Name: d.Get("name").(string), SessionAffinity: d.Get("session_affinity").(string), } if d.Get("failover_ratio") != nil { @@ -215,7 +215,6 @@ func calcAddRemove(from []string, to []string) ([]string, []string) { return add, remove } - func resourceComputeTargetPoolUpdate(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) diff --git a/builtin/providers/heroku/resource_heroku_cert_test.go b/builtin/providers/heroku/resource_heroku_cert_test.go index 89dcc55ce..4182ab575 100644 --- a/builtin/providers/heroku/resource_heroku_cert_test.go +++ b/builtin/providers/heroku/resource_heroku_cert_test.go @@ -2,9 +2,9 @@ package heroku import ( "fmt" + "io/ioutil" + "os" "testing" - "os" - "io/ioutil" "github.com/cyberdelia/heroku-go/v3" "github.com/hashicorp/terraform/helper/resource" @@ -13,11 +13,11 @@ import ( func TestAccHerokuCert_Basic(t *testing.T) { var endpoint heroku.SSLEndpoint - wd, _ := os.Getwd() - certificateChainFile := wd + "/test-fixtures/terraform.cert" - certificateChainBytes, _ := ioutil.ReadFile(certificateChainFile) - certificateChain := string(certificateChainBytes) - testAccCheckHerokuCertConfig_basic := ` + wd, _ := os.Getwd() + certificateChainFile := wd + "/test-fixtures/terraform.cert" + certificateChainBytes, _ := ioutil.ReadFile(certificateChainFile) + certificateChain := string(certificateChainBytes) + testAccCheckHerokuCertConfig_basic := ` resource "heroku_app" "foobar" { name = "terraform-test-cert-app" region = "eu" @@ -47,7 +47,7 @@ func TestAccHerokuCert_Basic(t *testing.T) { testAccCheckHerokuCertExists("heroku_cert.ssl_certificate", &endpoint), testAccCheckHerokuCertificateChain(&endpoint, certificateChain), resource.TestCheckResourceAttr( - "heroku_cert.ssl_certificate", "cname", "terraform-test-cert-app.herokuapp.com"), + "heroku_cert.ssl_certificate", "cname", "terraform-test-cert-app.herokuapp.com"), ), }, }, @@ -112,5 +112,3 @@ func testAccCheckHerokuCertExists(n string, endpoint *heroku.SSLEndpoint) resour return nil } } - -