github-vet / github-vet/rangeloop-pointer-findings
teimurjan/go-els-tg-bot: app/tgbot_app.go; 12 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [teimurjan/go-els-tg-bot](https://www.github.com/teimurjan/go-els-tg-bot) at [app/tgbot_app.go](https://github.com/teimurjan/go-els-tg-bot/blob/61d17e3485628f07a61c6facc1ff71ae5f569754/app/tgbot_app.go#L61-L72)
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 update used in defer or goroutine at line 64
[Click here to see the code in its original context.](https://github.com/teimurjan/go-els-tg-bot/blob/61d17e3485628f07a61c6facc1ff71ae5f569754/app/tgbot_app.go#L61-L72)
Click here to show the 12 line(s) of Go which triggered the analyzer.
```go
for update := range updates {
if update.Message != nil && update.Message.IsCommand() {
go func() {
tgBotApp.resetAllDialogs(&update)
tgBotApp.handleCommand(&update)
}()
} else if update.CallbackQuery != nil {
go tgBotApp.handleCallback(&update)
} else if update.Message != nil && len(update.Message.Text) > 0 {
go tgBotApp.handleText(&update)
}
}
```
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: 61d17e3485628f07a61c6facc1ff71ae5f569754
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in app/tgbot_app.go at lines 61-72 and inspect how the range variable update is passed to each goroutine. Check the referenced handlers and confirm the analyzer warning is addressed without changing command, callback, or text handling. Done means each goroutine receives the intended update rather than a shared range-loop variable.
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
- 35/100