From 3eb65f2cbb14f1504fca42e8899cafa0eb3a2fc9 Mon Sep 17 00:00:00 2001 From: Trevor Pounds Date: Fri, 12 Feb 2016 22:39:23 -0800 Subject: [PATCH] Enable `go vet -unusedresult` check and fix warnings. --- Makefile | 2 +- .../azure/resource_azure_sql_database_server_test.go | 2 +- .../azure/resource_azure_sql_database_service_test.go | 2 +- .../digitalocean/resource_digitalocean_floating_ip_test.go | 2 +- .../digitalocean/resource_digitalocean_ssh_key_test.go | 2 +- builtin/providers/google/resource_pubsub_subscription_test.go | 4 ++-- builtin/providers/google/resource_pubsub_topic_test.go | 4 ++-- builtin/providers/tls/resource_cert_request.go | 2 +- builtin/providers/tls/resource_certificate.go | 2 +- 9 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index d06de1f77..ccddba6d7 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ TEST?=$$(GO15VENDOREXPERIMENT=1 go list ./... | grep -v /vendor/) -VETARGS?=-asmdecl -atomic -bool -buildtags -composites -copylocks -methods -nilfunc -printf -rangeloops -shift -structtags -unsafeptr +VETARGS?=-asmdecl -atomic -bool -buildtags -composites -copylocks -methods -nilfunc -printf -rangeloops -shift -structtags -unsafeptr -unusedresult default: test diff --git a/builtin/providers/azure/resource_azure_sql_database_server_test.go b/builtin/providers/azure/resource_azure_sql_database_server_test.go index cee7cb4ed..46f6ae1cb 100644 --- a/builtin/providers/azure/resource_azure_sql_database_server_test.go +++ b/builtin/providers/azure/resource_azure_sql_database_server_test.go @@ -81,7 +81,7 @@ func testAccCheckAzureSqlDatabaseServerDeleted(s *terraform.State) error { for _, srv := range servers.DatabaseServers { if srv.Name == resource.Primary.ID { - fmt.Errorf("SQL Server %s still exists.", resource.Primary.ID) + return fmt.Errorf("SQL Server %s still exists.", resource.Primary.ID) } } } diff --git a/builtin/providers/azure/resource_azure_sql_database_service_test.go b/builtin/providers/azure/resource_azure_sql_database_service_test.go index 31ea8990e..f368abf68 100644 --- a/builtin/providers/azure/resource_azure_sql_database_service_test.go +++ b/builtin/providers/azure/resource_azure_sql_database_service_test.go @@ -156,7 +156,7 @@ func testAccCheckAzureSqlDatabaseServiceDeleted(s *terraform.State) error { for _, srv := range dbs.ServiceResources { if srv.Name == resource.Primary.ID { - fmt.Errorf("SQL Service %s still exists.", resource.Primary.ID) + return fmt.Errorf("SQL Service %s still exists.", resource.Primary.ID) } } } diff --git a/builtin/providers/digitalocean/resource_digitalocean_floating_ip_test.go b/builtin/providers/digitalocean/resource_digitalocean_floating_ip_test.go index ae53e1a89..5b57aa8dc 100644 --- a/builtin/providers/digitalocean/resource_digitalocean_floating_ip_test.go +++ b/builtin/providers/digitalocean/resource_digitalocean_floating_ip_test.go @@ -61,7 +61,7 @@ func testAccCheckDigitalOceanFloatingIPDestroy(s *terraform.State) error { _, _, err := client.FloatingIPs.Get(rs.Primary.ID) if err == nil { - fmt.Errorf("Floating IP still exists") + return fmt.Errorf("Floating IP still exists") } } diff --git a/builtin/providers/digitalocean/resource_digitalocean_ssh_key_test.go b/builtin/providers/digitalocean/resource_digitalocean_ssh_key_test.go index 3aebe1821..e14833fe9 100644 --- a/builtin/providers/digitalocean/resource_digitalocean_ssh_key_test.go +++ b/builtin/providers/digitalocean/resource_digitalocean_ssh_key_test.go @@ -51,7 +51,7 @@ func testAccCheckDigitalOceanSSHKeyDestroy(s *terraform.State) error { _, _, err = client.Keys.GetByID(id) if err == nil { - fmt.Errorf("SSH key still exists") + return fmt.Errorf("SSH key still exists") } } diff --git a/builtin/providers/google/resource_pubsub_subscription_test.go b/builtin/providers/google/resource_pubsub_subscription_test.go index 9cc0a218b..ad35e8e2c 100644 --- a/builtin/providers/google/resource_pubsub_subscription_test.go +++ b/builtin/providers/google/resource_pubsub_subscription_test.go @@ -36,7 +36,7 @@ func testAccCheckPubsubSubscriptionDestroy(s *terraform.State) error { config := testAccProvider.Meta().(*Config) _, err := config.clientPubsub.Projects.Subscriptions.Get(rs.Primary.ID).Do() if err != nil { - fmt.Errorf("Subscription still present") + return fmt.Errorf("Subscription still present") } } @@ -56,7 +56,7 @@ func testAccPubsubSubscriptionExists(n string) resource.TestCheckFunc { config := testAccProvider.Meta().(*Config) _, err := config.clientPubsub.Projects.Subscriptions.Get(rs.Primary.ID).Do() if err != nil { - fmt.Errorf("Subscription still present") + return fmt.Errorf("Subscription still present") } return nil diff --git a/builtin/providers/google/resource_pubsub_topic_test.go b/builtin/providers/google/resource_pubsub_topic_test.go index f81b9c21d..4305a1827 100644 --- a/builtin/providers/google/resource_pubsub_topic_test.go +++ b/builtin/providers/google/resource_pubsub_topic_test.go @@ -36,7 +36,7 @@ func testAccCheckPubsubTopicDestroy(s *terraform.State) error { config := testAccProvider.Meta().(*Config) _, err := config.clientPubsub.Projects.Topics.Get(rs.Primary.ID).Do() if err != nil { - fmt.Errorf("Topic still present") + return fmt.Errorf("Topic still present") } } @@ -56,7 +56,7 @@ func testAccPubsubTopicExists(n string) resource.TestCheckFunc { config := testAccProvider.Meta().(*Config) _, err := config.clientPubsub.Projects.Topics.Get(rs.Primary.ID).Do() if err != nil { - fmt.Errorf("Topic still present") + return fmt.Errorf("Topic still present") } return nil diff --git a/builtin/providers/tls/resource_cert_request.go b/builtin/providers/tls/resource_cert_request.go index 7dd1430c6..267f0db39 100644 --- a/builtin/providers/tls/resource_cert_request.go +++ b/builtin/providers/tls/resource_cert_request.go @@ -107,7 +107,7 @@ func CreateCertRequest(d *schema.ResourceData, meta interface{}) error { certReqBytes, err := x509.CreateCertificateRequest(rand.Reader, &certReq, key) if err != nil { - fmt.Errorf("Error creating certificate request: %s", err) + return fmt.Errorf("Error creating certificate request: %s", err) } certReqPem := string(pem.EncodeToMemory(&pem.Block{Type: pemCertReqType, Bytes: certReqBytes})) diff --git a/builtin/providers/tls/resource_certificate.go b/builtin/providers/tls/resource_certificate.go index bfdc6eea7..d30efa720 100644 --- a/builtin/providers/tls/resource_certificate.go +++ b/builtin/providers/tls/resource_certificate.go @@ -159,7 +159,7 @@ func createCertificate(d *schema.ResourceData, template, parent *x509.Certificat certBytes, err := x509.CreateCertificate(rand.Reader, template, parent, pub, priv) if err != nil { - fmt.Errorf("error creating certificate: %s", err) + return fmt.Errorf("error creating certificate: %s", err) } certPem := string(pem.EncodeToMemory(&pem.Block{Type: pemCertType, Bytes: certBytes}))