github-vet / github-vet/rangeloop-pointer-findings
SG5/tg-currency-bot: telegram.go; 18 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [SG5/tg-currency-bot](https://www.github.com/SG5/tg-currency-bot) at [telegram.go](https://github.com/SG5/tg-currency-bot/blob/f4042d4942bb475a2c3c4a269999116d5da03350/telegram.go#L45-L62)
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.
> function call at line 61 may store a reference to update
[Click here to see the code in its original context.](https://github.com/SG5/tg-currency-bot/blob/f4042d4942bb475a2c3c4a269999116d5da03350/telegram.go#L45-L62)
Click here to show the 18 line(s) of Go which triggered the analyzer.
```go
for update := range updates {
if nil == update.Message || 0 == len(update.Message.Text) {
continue
}
log.Printf("[%s] %s", update.Message.From.UserName, update.Message.Text)
if _, ok := chats[update.Message.Chat.ID]; !ok {
chat := Chat{
ChatId: update.Message.Chat.ID,
}
db.Where("chat_id = ?", update.Message.Chat.ID).First(&chat)
chats[update.Message.Chat.ID] = &chat
}
go bot.Send(handleMessage(&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: f4042d4942bb475a2c3c4a269999116d5da03350
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.