github-vet / github-vet/rangeloop-pointer-findings
pepeground/pososyamba_bot: internal/app/bot/bot_client.go; 31 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [pepeground/pososyamba_bot](https://www.github.com/pepeground/pososyamba_bot) at [internal/app/bot/bot_client.go](https://github.com/pepeground/pososyamba_bot/blob/7d437a3897770e3774f18b78d78a5f639cee22dc/internal/app/bot/bot_client.go#L72-L102)
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 which takes a reference to update at line 101 may start a goroutine
[Click here to see the code in its original context.](https://github.com/pepeground/pososyamba_bot/blob/7d437a3897770e3774f18b78d78a5f639cee22dc/internal/app/bot/bot_client.go#L72-L102)
Click here to show the 31 line(s) of Go which triggered the analyzer.
```go
for update := range updates {
log.Printf("%+v\n", update)
if update.InlineQuery != nil {
go inlineQueryHandler(bot, update, preparedPhrases, sb)
continue
}
if update.ChannelPost != nil {
if update.ChannelPost.Text != "" { // if channel post is a plain text
go mrkshi.UpdatePhrases(update.ChannelPost.Text, &mrkshi_phrases)
continue
}
if update.ChannelPost.Caption != "" { // if channel post is a photo with caption
go mrkshi.UpdatePhrases(update.ChannelPost.Caption, &mrkshi_phrases)
continue
}
}
if update.Message == nil { // ignore any non-Message updates
continue
}
if !update.Message.IsCommand() { // ignore any non-command Messages
continue
}
go messageCommandHandler(&update, &c)
}
```
Click here to show extra information the analyzer produced.
```
The following graphviz dot graph describes paths through the callgraph that could lead to a function calling a goroutine:
digraph G {
"(messageCommandHandler, 2)" -> {"(MRKSHI, 1)";}
"(MRKSHI, 1)" -> {}
}
```
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: 7d437a3897770e3774f18b78d78a5f639cee22dc
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.