mirror of
https://github.com/opentofu/opentofu.git
synced 2025-01-01 11:47:07 -06:00
Merge pull request #999 from TimeInc/clean-code
Clean code (get rid of go vet errors)
This commit is contained in:
commit
c7e536680d
@ -336,7 +336,7 @@ func resourceAwsAutoscalingGroupDrain(d *schema.ResourceData, meta interface{})
|
||||
return resource.Retry(10*time.Minute, func() error {
|
||||
g, err := getAwsAutoscalingGroup(d, meta)
|
||||
if err != nil {
|
||||
return resource.RetryError{err}
|
||||
return resource.RetryError{Err: err}
|
||||
}
|
||||
if g == nil {
|
||||
return nil
|
||||
|
@ -42,7 +42,8 @@ func testAccCheckDBSubnetGroupDestroy(s *terraform.State) error {
|
||||
}
|
||||
|
||||
// Try to find the resource
|
||||
resp, err := conn.DescribeDBSubnetGroups(&rds.DescribeDBSubnetGroups{rs.Primary.ID})
|
||||
resp, err := conn.DescribeDBSubnetGroups(
|
||||
&rds.DescribeDBSubnetGroups{DBSubnetGroupName: rs.Primary.ID})
|
||||
if err == nil {
|
||||
if len(resp.DBSubnetGroups) > 0 {
|
||||
return fmt.Errorf("still exist.")
|
||||
@ -76,7 +77,8 @@ func testAccCheckDBSubnetGroupExists(n string, v *rds.DBSubnetGroup) resource.Te
|
||||
}
|
||||
|
||||
conn := testAccProvider.Meta().(*AWSClient).rdsconn
|
||||
resp, err := conn.DescribeDBSubnetGroups(&rds.DescribeDBSubnetGroups{rs.Primary.ID})
|
||||
resp, err := conn.DescribeDBSubnetGroups(
|
||||
&rds.DescribeDBSubnetGroups{DBSubnetGroupName: rs.Primary.ID})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -219,7 +219,7 @@ func resourceAwsEipDelete(d *schema.ResourceData, meta interface{}) error {
|
||||
return nil
|
||||
}
|
||||
if _, ok := err.(*ec2.Error); !ok {
|
||||
return resource.RetryError{err}
|
||||
return resource.RetryError{Err: err}
|
||||
}
|
||||
|
||||
return err
|
||||
|
@ -124,7 +124,7 @@ func resourceAwsInternetGatewayDelete(d *schema.ResourceData, meta interface{})
|
||||
return err // retry
|
||||
}
|
||||
|
||||
return resource.RetryError{err}
|
||||
return resource.RetryError{Err: err}
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -268,10 +268,10 @@ func resourceAwsNetworkAclDelete(d *schema.ResourceData, meta interface{}) error
|
||||
return fmt.Errorf("Dependency violation: Cannot delete acl %s: %s", d.Id(), err)
|
||||
}
|
||||
_, err = ec2conn.ReplaceNetworkAclAssociation(association.NetworkAclAssociationId, defaultAcl.NetworkAclId)
|
||||
return resource.RetryError{err}
|
||||
return resource.RetryError{Err: err}
|
||||
default:
|
||||
// Any other error, we want to quit the retry loop immediately
|
||||
return resource.RetryError{err}
|
||||
return resource.RetryError{Err: err}
|
||||
}
|
||||
}
|
||||
log.Printf("[Info] Deleted network ACL %s successfully", d.Id())
|
||||
|
@ -268,7 +268,7 @@ func resourceAwsSecurityGroupDelete(d *schema.ResourceData, meta interface{}) er
|
||||
return err
|
||||
default:
|
||||
// Any other error, we want to quit the retry loop immediately
|
||||
return resource.RetryError{err}
|
||||
return resource.RetryError{Err: err}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -109,11 +109,9 @@ func (c *RemoteCommand) Run(args []string) int {
|
||||
case !haveLocal && haveNonManaged:
|
||||
// Enable remote state management
|
||||
return c.enableRemoteState()
|
||||
|
||||
default:
|
||||
panic("unhandled case")
|
||||
}
|
||||
return 0
|
||||
|
||||
panic("unhandled case")
|
||||
}
|
||||
|
||||
// disableRemoteState is used to disable remote state management,
|
||||
|
@ -213,10 +213,9 @@ func (c *AtlasRemoteClient) DeleteState() error {
|
||||
return ErrInvalidAuth
|
||||
case http.StatusInternalServerError:
|
||||
return ErrRemoteInternal
|
||||
default:
|
||||
return fmt.Errorf("Unexpected HTTP response code %d", resp.StatusCode)
|
||||
}
|
||||
return nil
|
||||
|
||||
return fmt.Errorf("Unexpected HTTP response code %d", resp.StatusCode)
|
||||
}
|
||||
|
||||
func (c *AtlasRemoteClient) url() *url.URL {
|
||||
|
Loading…
Reference in New Issue
Block a user