Enable `go vet -unusedresult` check and fix warnings.
This commit is contained in:
parent
79742fc367
commit
3eb65f2cbb
2
Makefile
2
Makefile
|
@ -1,5 +1,5 @@
|
||||||
TEST?=$$(GO15VENDOREXPERIMENT=1 go list ./... | grep -v /vendor/)
|
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
|
default: test
|
||||||
|
|
||||||
|
|
|
@ -81,7 +81,7 @@ func testAccCheckAzureSqlDatabaseServerDeleted(s *terraform.State) error {
|
||||||
|
|
||||||
for _, srv := range servers.DatabaseServers {
|
for _, srv := range servers.DatabaseServers {
|
||||||
if srv.Name == resource.Primary.ID {
|
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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -156,7 +156,7 @@ func testAccCheckAzureSqlDatabaseServiceDeleted(s *terraform.State) error {
|
||||||
|
|
||||||
for _, srv := range dbs.ServiceResources {
|
for _, srv := range dbs.ServiceResources {
|
||||||
if srv.Name == resource.Primary.ID {
|
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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@ func testAccCheckDigitalOceanFloatingIPDestroy(s *terraform.State) error {
|
||||||
_, _, err := client.FloatingIPs.Get(rs.Primary.ID)
|
_, _, err := client.FloatingIPs.Get(rs.Primary.ID)
|
||||||
|
|
||||||
if err == nil {
|
if err == nil {
|
||||||
fmt.Errorf("Floating IP still exists")
|
return fmt.Errorf("Floating IP still exists")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ func testAccCheckDigitalOceanSSHKeyDestroy(s *terraform.State) error {
|
||||||
_, _, err = client.Keys.GetByID(id)
|
_, _, err = client.Keys.GetByID(id)
|
||||||
|
|
||||||
if err == nil {
|
if err == nil {
|
||||||
fmt.Errorf("SSH key still exists")
|
return fmt.Errorf("SSH key still exists")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ func testAccCheckPubsubSubscriptionDestroy(s *terraform.State) error {
|
||||||
config := testAccProvider.Meta().(*Config)
|
config := testAccProvider.Meta().(*Config)
|
||||||
_, err := config.clientPubsub.Projects.Subscriptions.Get(rs.Primary.ID).Do()
|
_, err := config.clientPubsub.Projects.Subscriptions.Get(rs.Primary.ID).Do()
|
||||||
if err != nil {
|
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)
|
config := testAccProvider.Meta().(*Config)
|
||||||
_, err := config.clientPubsub.Projects.Subscriptions.Get(rs.Primary.ID).Do()
|
_, err := config.clientPubsub.Projects.Subscriptions.Get(rs.Primary.ID).Do()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Errorf("Subscription still present")
|
return fmt.Errorf("Subscription still present")
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -36,7 +36,7 @@ func testAccCheckPubsubTopicDestroy(s *terraform.State) error {
|
||||||
config := testAccProvider.Meta().(*Config)
|
config := testAccProvider.Meta().(*Config)
|
||||||
_, err := config.clientPubsub.Projects.Topics.Get(rs.Primary.ID).Do()
|
_, err := config.clientPubsub.Projects.Topics.Get(rs.Primary.ID).Do()
|
||||||
if err != nil {
|
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)
|
config := testAccProvider.Meta().(*Config)
|
||||||
_, err := config.clientPubsub.Projects.Topics.Get(rs.Primary.ID).Do()
|
_, err := config.clientPubsub.Projects.Topics.Get(rs.Primary.ID).Do()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Errorf("Topic still present")
|
return fmt.Errorf("Topic still present")
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -107,7 +107,7 @@ func CreateCertRequest(d *schema.ResourceData, meta interface{}) error {
|
||||||
|
|
||||||
certReqBytes, err := x509.CreateCertificateRequest(rand.Reader, &certReq, key)
|
certReqBytes, err := x509.CreateCertificateRequest(rand.Reader, &certReq, key)
|
||||||
if err != nil {
|
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}))
|
certReqPem := string(pem.EncodeToMemory(&pem.Block{Type: pemCertReqType, Bytes: certReqBytes}))
|
||||||
|
|
||||||
|
|
|
@ -159,7 +159,7 @@ func createCertificate(d *schema.ResourceData, template, parent *x509.Certificat
|
||||||
|
|
||||||
certBytes, err := x509.CreateCertificate(rand.Reader, template, parent, pub, priv)
|
certBytes, err := x509.CreateCertificate(rand.Reader, template, parent, pub, priv)
|
||||||
if err != nil {
|
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}))
|
certPem := string(pem.EncodeToMemory(&pem.Block{Type: pemCertType, Bytes: certBytes}))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue