github-vet / github-vet/rangeloop-pointer-findings
cgrates/cgrates: sessions/sessions.go; 25 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [cgrates/cgrates](https://www.github.com/cgrates/cgrates) at [sessions/sessions.go](https://github.com/cgrates/cgrates/blob/fd090f5b36bf39eaf7f4c594ae11e7940f74c168/sessions/sessions.go#L1320-L1344)
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 clnt used in defer or goroutine at line 1324
[Click here to see the code in its original context.](https://github.com/cgrates/cgrates/blob/fd090f5b36bf39eaf7f4c594ae11e7940f74c168/sessions/sessions.go#L1320-L1344)
Click here to show the 25 line(s) of Go which triggered the analyzer.
```go
for _, clnt := range sS.biJClients() {
errChan := make(chan error)
go func() {
var queriedSessionIDs []*SessionID
if err := clnt.conn.Call(utils.SessionSv1GetActiveSessionIDs,
utils.EmptyString, &queriedSessionIDs); err != nil {
errChan <- err
}
for _, sessionID := range queriedSessionIDs {
queriedCGRIDs.Set(sessionID.CGRID(), struct{}{})
}
errChan <- nil
}()
select {
case err = <-errChan:
if err != nil {
utils.Logger.Warning(
fmt.Sprintf("<%s> error <%s> quering session ids", utils.SessionS, err.Error()))
}
case <-time.After(sS.cgrCfg.GeneralCfg().ReplyTimeout):
utils.Logger.Warning(
fmt.Sprintf("<%s> timeout quering session ids ", utils.SessionS))
}
}
```
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: fd090f5b36bf39eaf7f4c594ae11e7940f74c168
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.