You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The condition err != nil in line 122 will always evaluate to false (due to the early exit in line 118). This implies that potential errors from the call to getTargetAuzureResourceGroupName (line 121) are ignored.
Supposedly, the condition should be err2 != nil .
To Reproduce
No reproducer. Found by statical analysis.
// GetRecoveryServicesVaultBackupProtectedVMListE returns a list of protected VM's on the given vault/policy.funcGetRecoveryServicesVaultBackupProtectedVMListE(policyName, vaultName, resourceGroupName, subscriptionIDstring) (map[string]backup.AzureIaaSComputeVMProtectedItem, error) {
subscriptionID, err:=getTargetAzureSubscription(subscriptionID)
iferr!=nil {
returnnil, err
}
resourceGroupName, err2:=getTargetAzureResourceGroupName(resourceGroupName)
iferr!=nil { // <- always false returnnil, err2
}
// ...
}
Versions
Terratest version: v0.46.15
Environment details (Ubuntu 20.04, Windows 10, etc.):
Describe the bug
Line 122 in
modules/azure/recoveryservices.go#GetRecoveryServicesVaultBackupProtect
violates nilness: check for redundant or impossible conditions.The condition
err != nil
in line 122 will always evaluate to false (due to the early exit in line 118). This implies that potential errors from the call togetTargetAuzureResourceGroupName
(line 121) are ignored.Supposedly, the condition should be
err2 != nil
.To Reproduce
No reproducer. Found by statical analysis.
Versions
The text was updated successfully, but these errors were encountered: