github-vet / github-vet/rangeloop-pointer-findings
lawrencegripper/azbrowse: internal/pkg/expanders/storageManagementPolicies.go; 30 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [lawrencegripper/azbrowse](https://www.github.com/lawrencegripper/azbrowse) at [internal/pkg/expanders/storageManagementPolicies.go](https://github.com/lawrencegripper/azbrowse/blob/3b2e188fe1c206cbf8a841774c041adac8721f91/internal/pkg/expanders/storageManagementPolicies.go#L56-L85)
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 resourceType was used in a composite literal at line 80
[Click here to see the code in its original context.](https://github.com/lawrencegripper/azbrowse/blob/3b2e188fe1c206cbf8a841774c041adac8721f91/internal/pkg/expanders/storageManagementPolicies.go#L56-L85)
Click here to show the 30 line(s) of Go which triggered the analyzer.
```go
for _, resourceType := range swaggerResourceType.SubResources {
if resourceType.Endpoint.TemplateURL == "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}" {
// got the management policies endpoint
// now create the expand URL etc etc
defaultPolicyTemplateValues := make(map[string]string)
for k, v := range templateValues {
defaultPolicyTemplateValues[k] = v
}
defaultPolicyTemplateValues["managementPolicyName"] = "default"
url, err := resourceType.Endpoint.BuildURL(defaultPolicyTemplateValues)
if err != nil {
return ExpanderResult{
Err: err,
}
}
newItems = append(newItems, &TreeNode{
Parentid: currentItem.ID,
Namespace: "storageManagementPolicies",
Name: "ManagementPolicy",
Display: "Management Policy",
ItemType: SubResourceType,
ExpandURL: url,
SwaggerResourceType: &resourceType,
})
break
}
}
```
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: 3b2e188fe1c206cbf8a841774c041adac8721f91
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.