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 {
|
return resource.Retry(10*time.Minute, func() error {
|
||||||
g, err := getAwsAutoscalingGroup(d, meta)
|
g, err := getAwsAutoscalingGroup(d, meta)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return resource.RetryError{err}
|
return resource.RetryError{Err: err}
|
||||||
}
|
}
|
||||||
if g == nil {
|
if g == nil {
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -42,7 +42,8 @@ func testAccCheckDBSubnetGroupDestroy(s *terraform.State) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try to find the resource
|
// 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 err == nil {
|
||||||
if len(resp.DBSubnetGroups) > 0 {
|
if len(resp.DBSubnetGroups) > 0 {
|
||||||
return fmt.Errorf("still exist.")
|
return fmt.Errorf("still exist.")
|
||||||
|
@ -76,7 +77,8 @@ func testAccCheckDBSubnetGroupExists(n string, v *rds.DBSubnetGroup) resource.Te
|
||||||
}
|
}
|
||||||
|
|
||||||
conn := testAccProvider.Meta().(*AWSClient).rdsconn
|
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 {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -219,7 +219,7 @@ func resourceAwsEipDelete(d *schema.ResourceData, meta interface{}) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if _, ok := err.(*ec2.Error); !ok {
|
if _, ok := err.(*ec2.Error); !ok {
|
||||||
return resource.RetryError{err}
|
return resource.RetryError{Err: err}
|
||||||
}
|
}
|
||||||
|
|
||||||
return err
|
return err
|
||||||
|
|
|
@ -124,7 +124,7 @@ func resourceAwsInternetGatewayDelete(d *schema.ResourceData, meta interface{})
|
||||||
return err // retry
|
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)
|
return fmt.Errorf("Dependency violation: Cannot delete acl %s: %s", d.Id(), err)
|
||||||
}
|
}
|
||||||
_, err = ec2conn.ReplaceNetworkAclAssociation(association.NetworkAclAssociationId, defaultAcl.NetworkAclId)
|
_, err = ec2conn.ReplaceNetworkAclAssociation(association.NetworkAclAssociationId, defaultAcl.NetworkAclId)
|
||||||
return resource.RetryError{err}
|
return resource.RetryError{Err: err}
|
||||||
default:
|
default:
|
||||||
// Any other error, we want to quit the retry loop immediately
|
// 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())
|
log.Printf("[Info] Deleted network ACL %s successfully", d.Id())
|
||||||
|
|
|
@ -268,7 +268,7 @@ func resourceAwsSecurityGroupDelete(d *schema.ResourceData, meta interface{}) er
|
||||||
return err
|
return err
|
||||||
default:
|
default:
|
||||||
// Any other error, we want to quit the retry loop immediately
|
// 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:
|
case !haveLocal && haveNonManaged:
|
||||||
// Enable remote state management
|
// Enable remote state management
|
||||||
return c.enableRemoteState()
|
return c.enableRemoteState()
|
||||||
|
|
||||||
default:
|
|
||||||
panic("unhandled case")
|
|
||||||
}
|
}
|
||||||
return 0
|
|
||||||
|
panic("unhandled case")
|
||||||
}
|
}
|
||||||
|
|
||||||
// disableRemoteState is used to disable remote state management,
|
// disableRemoteState is used to disable remote state management,
|
||||||
|
|
|
@ -213,10 +213,9 @@ func (c *AtlasRemoteClient) DeleteState() error {
|
||||||
return ErrInvalidAuth
|
return ErrInvalidAuth
|
||||||
case http.StatusInternalServerError:
|
case http.StatusInternalServerError:
|
||||||
return ErrRemoteInternal
|
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 {
|
func (c *AtlasRemoteClient) url() *url.URL {
|
||||||
|
|
Loading…
Reference in New Issue