github-vet / github-vet/rangeloop-pointer-findings
marperia/fwdbot: app/start.go; 13 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [marperia/fwdbot](https://www.github.com/marperia/fwdbot) at [app/start.go](https://github.com/marperia/fwdbot/blob/f8f65f1bff2808bab75e445f617656dd440028e4/app/start.go#L10-L22)
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 i used in defer or goroutine at line 12
[Click here to see the code in its original context.](https://github.com/marperia/fwdbot/blob/f8f65f1bff2808bab75e445f617656dd440028e4/app/start.go#L10-L22)
Click here to show the 13 line(s) of Go which triggered the analyzer.
```go
for i := range accounts.TdInstances {
go func() {
accounts.TdInstances[i].LoginToTdlib()
receiver := accounts.TdInstances[i].TdlibClient.AddEventReceiver(&tdlib.UpdateNewMessage{}, accounts.MessageFilter, 10)
for newMsg := range receiver.Chan {
accounts.NewMessageHandle(newMsg, accounts.TdInstances[i])
}
accounts.CreateUpdateChannel(accounts.TdInstances[i].TdlibClient)
}()
time.Sleep(300 * time.Millisecond)
}
```
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: f8f65f1bff2808bab75e445f617656dd440028e4
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with app/start.go lines 10-22 and inspect the reported range-loop capture warning in its original context. Check the surrounding account and goroutine behavior, then build or run the available project checks. Done means each launched goroutine operates on the intended account without the analyzer warning.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100