github-vet / github-vet/rangeloop-pointer-findings
umavanth21/terraform-azure-instance: azurerm/resource_arm_container_registry.go; 21 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [umavanth21/terraform-azure-instance](https://www.github.com/umavanth21/terraform-azure-instance) at [azurerm/resource_arm_container_registry.go](https://github.com/umavanth21/terraform-azure-instance/blob/f25975f0fd0cbfc876a48061c29c5b1b75696bf1/azurerm/resource_arm_container_registry.go#L433-L453)
Below is the message reported by the analyzer for this snippet of code. Beware that the analyzer only reports the first
issue it finds, so please do not limit your consideration to the contents of the below message.
> reference to locationToCreate was used in a composite literal at line 441
[Click here to see the code in its original context.](https://github.com/umavanth21/terraform-azure-instance/blob/f25975f0fd0cbfc876a48061c29c5b1b75696bf1/azurerm/resource_arm_container_registry.go#L433-L453)
Click here to show the 21 line(s) of Go which triggered the analyzer.
```go
for locationToCreate := range createLocations {
// if false, the location does not need to be created, continue
if !createLocations[locationToCreate] {
continue
}
// create the new replication location
replication := containerregistry.Replication{
Location: &locationToCreate,
Name: &locationToCreate,
}
future, err := replicationClient.Create(ctx, resourceGroup, name, locationToCreate, replication)
if err != nil {
return fmt.Errorf("Error creating Container Registry Replication %q (Resource Group %q, Location %q): %+v", name, resourceGroup, locationToCreate, err)
}
if err = future.WaitForCompletionRef(ctx, replicationClient.Client); err != nil {
return fmt.Errorf("Error waiting for creation of Container Registry Replication %q (Resource Group %q, Location %q): %+v", name, resourceGroup, locationToCreate, err)
}
}
```
Leave a reaction on this issue to contribute to the project by classifying this instance as a **Bug** :-1:, **Mitigated** :+1:, or **Desirable Behavior** :rocket:
See the descriptions of the classifications [here](https://github.com/github-vet/rangeclosure-findings#how-can-i-help) for more information.
commit ID: f25975f0fd0cbfc876a48061c29c5b1b75696bf1
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.