github-vet / github-vet/rangeloop-pointer-findings
Nuvoloso/kontroller_open_source: pkg/centrald/vreq/allocate_capacity.go; 26 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [Nuvoloso/kontroller_open_source](https://www.github.com/Nuvoloso/kontroller_open_source) at [pkg/centrald/vreq/allocate_capacity.go](https://github.com/Nuvoloso/kontroller_open_source/blob/4ae989b8a947bb0d0db609e85b71bc91546237ce/pkg/centrald/vreq/allocate_capacity.go#L840-L865)
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 spr was used in a composite literal at line 845
[Click here to see the code in its original context.](https://github.com/Nuvoloso/kontroller_open_source/blob/4ae989b8a947bb0d0db609e85b71bc91546237ce/pkg/centrald/vreq/allocate_capacity.go#L840-L865)
Click here to show the 26 line(s) of Go which triggered the analyzer.
```go
for poolID, spr := range sprMap {
for _, p := range pools {
if string(p.Meta.ID) == poolID {
sca := &SetCapacityArgs{
ServicePlanAllocationID: string(op.spa.Meta.ID),
Capacity: &spr,
Pool: p,
}
op.c.Log.Debugf("VolumeSeriesRequest %s: setting pool [%s] capacity (%d,%d)", op.rhs.Request.Meta.ID, poolID, spr.NumMirrors, swag.Int64Value(spr.SizeBytes))
var o *models.Pool
var err error
err = op.c.rei.ErrOnBool("ac-fail-pool-set-capacity")
if err == nil {
o, err = op.ops.setPoolCapacityForSPA(ctx, sca)
}
if err != nil {
op.rhs.SetAndUpdateRequestMessage(ctx, "Error updating pool [%s]: %s", poolID, err.Error())
op.rhs.RetryLater = true
return
}
op.pools[string(p.CspStorageType)] = o
op.rhs.SetRequestMessage("Set capacity in pool [%s] to (%d, %s)", poolID, spr.NumMirrors, util.SizeBytes(swag.Int64Value(spr.SizeBytes)))
break // pool loop
}
}
}
```
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: 4ae989b8a947bb0d0db609e85b71bc91546237ce
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.