Skip to content

Commit

Permalink
Merge pull request #3065 from terraform-providers/b/linting
Browse files Browse the repository at this point in the history
Fixing errors caught by the updated linter
  • Loading branch information
tombuildsstuff authored Mar 18, 2019
2 parents 687b4e2 + 0dbef02 commit 71d3687
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 25 deletions.
4 changes: 2 additions & 2 deletions azurerm/data_source_notification_hub.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,12 @@ func dataSourceNotificationHubRead(d *schema.ResourceData, meta interface{}) err

if props := credentials.PnsCredentialsProperties; props != nil {
apns := flattenNotificationHubsDataSourceAPNSCredentials(props.ApnsCredential)
if d.Set("apns_credential", apns); err != nil {
if setErr := d.Set("apns_credential", apns); setErr != nil {
return fmt.Errorf("Error setting `apns_credential`: %+v", err)
}

gcm := flattenNotificationHubsDataSourceGCMCredentials(props.GcmCredential)
if d.Set("gcm_credential", gcm); err != nil {
if setErr := d.Set("gcm_credential", gcm); setErr != nil {
return fmt.Errorf("Error setting `gcm_credential`: %+v", err)
}
}
Expand Down
2 changes: 1 addition & 1 deletion azurerm/encryption_settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func flattenManagedDiskEncryptionSettings(encryptionSettings *compute.Encryption

keys["key_url"] = *key.KeyURL

if vault := key.SourceVault; key != nil {
if vault := key.SourceVault; vault != nil {
keys["source_vault_id"] = *vault.ID
}

Expand Down
4 changes: 2 additions & 2 deletions azurerm/resource_arm_application_gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -1060,7 +1060,7 @@ func resourceArmApplicationGatewayRead(d *schema.ResourceData, meta interface{})
return fmt.Errorf("Error setting `url_path_map`: %+v", setErr)
}

if setErr := d.Set("waf_configuration", flattenApplicationGatewayWafConfig(props.WebApplicationFirewallConfiguration)); err != nil {
if setErr := d.Set("waf_configuration", flattenApplicationGatewayWafConfig(props.WebApplicationFirewallConfiguration)); setErr != nil {
return fmt.Errorf("Error setting `waf_configuration`: %+v", setErr)
}
}
Expand Down Expand Up @@ -2227,7 +2227,7 @@ func flattenApplicationGatewayURLPathMaps(input *[]network.ApplicationGatewayURL
ruleOutput["name"] = *rule.Name
}

if ruleProps := rule.ApplicationGatewayPathRulePropertiesFormat; props != nil {
if ruleProps := rule.ApplicationGatewayPathRulePropertiesFormat; ruleProps != nil {
if pool := ruleProps.BackendAddressPool; pool != nil && pool.ID != nil {
poolId, err := parseAzureResourceID(*pool.ID)
if err != nil {
Expand Down
3 changes: 0 additions & 3 deletions azurerm/resource_arm_key_vault_certificate.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ func resourceArmKeyVaultChildResourceImporter(d *schema.ResourceData, meta inter
if err != nil {
return []*schema.ResourceData{d}, fmt.Errorf("Error retrieving the Resource ID the Key Vault at URL %q: %s", id.KeyVaultBaseUrl, err)
}
if id == nil {
return []*schema.ResourceData{d}, fmt.Errorf("Unable to locate the Resource ID for the Key Vault at URL %q: %s", id.KeyVaultBaseUrl, err)
}

d.Set("key_vault_id", kvid)

Expand Down
12 changes: 5 additions & 7 deletions azurerm/resource_arm_monitor_log_profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,14 +254,12 @@ func flattenAzureRmLogProfileRetentionPolicy(input *insights.RetentionPolicy) []
}

result := make(map[string]interface{})
if input != nil {
if input.Enabled != nil {
result["enabled"] = *input.Enabled
}
if input.Enabled != nil {
result["enabled"] = *input.Enabled
}

if input.Days != nil {
result["days"] = *input.Days
}
if input.Days != nil {
result["days"] = *input.Days
}

return []interface{}{result}
Expand Down
8 changes: 4 additions & 4 deletions azurerm/resource_arm_notification_hub.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,13 +254,13 @@ func resourceArmNotificationHubRead(d *schema.ResourceData, meta interface{}) er

if props := credentials.PnsCredentialsProperties; props != nil {
apns := flattenNotificationHubsAPNSCredentials(props.ApnsCredential)
if d.Set("apns_credential", apns); err != nil {
return fmt.Errorf("Error setting `apns_credential`: %+v", err)
if setErr := d.Set("apns_credential", apns); setErr != nil {
return fmt.Errorf("Error setting `apns_credential`: %+v", setErr)
}

gcm := flattenNotificationHubsGCMCredentials(props.GcmCredential)
if d.Set("gcm_credential", gcm); err != nil {
return fmt.Errorf("Error setting `gcm_credential`: %+v", err)
if setErr := d.Set("gcm_credential", gcm); setErr != nil {
return fmt.Errorf("Error setting `gcm_credential`: %+v", setErr)
}
}

Expand Down
2 changes: 1 addition & 1 deletion azurerm/resource_arm_role_assignment.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ func resourceArmRoleAssignmentRead(d *schema.ResourceData, meta interface{}) err
return fmt.Errorf("Error loading Role Definition %q: %+v", *roleId, err)
}

if roleProps := roleResp.RoleDefinitionProperties; props != nil {
if roleProps := roleResp.RoleDefinitionProperties; roleProps != nil {
d.Set("role_definition_name", roleProps.RoleName)
}
}
Expand Down
4 changes: 0 additions & 4 deletions azurerm/resource_arm_sql_database.go
Original file line number Diff line number Diff line change
Expand Up @@ -559,10 +559,6 @@ func resourceArmSqlDatabaseDelete(d *schema.ResourceData, meta interface{}) erro
return nil
}

return fmt.Errorf("Error making Read request on Sql Database %s: %+v", name, err)
}

if err != nil {
return fmt.Errorf("Error deleting SQL Database: %+v", err)
}

Expand Down
2 changes: 1 addition & 1 deletion azurerm/resource_arm_virtual_machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -1911,7 +1911,7 @@ func determineVirtualMachineIPAddress(ctx context.Context, meta interface{}, pro
return "", fmt.Errorf("Error obtaining Public IP %q (Resource Group %q): %+v", name, resourceGroup, err)
}

if pipProps := pip.PublicIPAddressPropertiesFormat; props != nil {
if pipProps := pip.PublicIPAddressPropertiesFormat; pipProps != nil {
if ip := pipProps.IPAddress; ip != nil {
return *ip, nil
}
Expand Down

0 comments on commit 71d3687

Please sign in to comment.