github-vet / github-vet/rangeloop-pointer-findings
svraju/CGRATES: engine/action_plan.go; 45 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [svraju/CGRATES](https://www.github.com/svraju/CGRATES) at [engine/action_plan.go](https://github.com/svraju/CGRATES/blob/76bb3e0a20744913524de6d2286e2a25c6313fb6/engine/action_plan.go#L304-L348)
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.
> range-loop variable a used in defer or goroutine at line 338
[Click here to see the code in its original context.](https://github.com/svraju/CGRATES/blob/76bb3e0a20744913524de6d2286e2a25c6313fb6/engine/action_plan.go#L304-L348)
Click here to show the 45 line(s) of Go which triggered the analyzer.
```go
for _, a := range aac {
// check action filter
if len(a.Filter) > 0 {
matched, err := acc.matchActionFilter(a.Filter)
//log.Print("Checkng: ", a.Filter, matched)
if err != nil {
return 0, err
}
if !matched {
continue
}
}
if a.Balance == nil {
a.Balance = &BalanceFilter{}
}
if a.ExpirationString != "" { // if it's *unlimited then it has to be zero time
if expDate, parseErr := utils.ParseDate(a.ExpirationString); parseErr == nil {
a.Balance.ExpirationDate = &time.Time{}
*a.Balance.ExpirationDate = expDate
}
}
actionFunction, exists := getActionFunc(a.ActionType)
if !exists {
// do not allow the action plan to be rescheduled
at.Timing = nil
utils.Logger.Err(fmt.Sprintf("Function type %v not available, aborting execution!", a.ActionType))
transactionFailed = true
break
}
if err := actionFunction(acc, nil, a, aac); err != nil {
utils.Logger.Err(fmt.Sprintf("Error executing action %s: %v!", a.ActionType, err))
transactionFailed = true
if failedActions != nil {
go func() { failedActions <- a }()
}
break
}
if successActions != nil {
go func() { successActions <- a }()
}
if a.ActionType == REMOVE_ACCOUNT {
removeAccountActionFound = true
}
}
```
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: 76bb3e0a20744913524de6d2286e2a25c6313fb6
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.