github-vet / github-vet/rangeloop-pointer-findings
LikiPiki/UwdBot: internal/pkg/controller/controller.go; 45 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [LikiPiki/UwdBot](https://www.github.com/LikiPiki/UwdBot) at [internal/pkg/controller/controller.go](https://github.com/LikiPiki/UwdBot/blob/70097f7c289a77b9cd0f87266171fa977763cb3f/internal/pkg/controller/controller.go#L46-L90)
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 50 may start a goroutine
[Click here to see the code in its original context.](https://github.com/LikiPiki/UwdBot/blob/70097f7c289a77b9cd0f87266171fa977763cb3f/internal/pkg/controller/controller.go#L46-L90)
Click here to show the 45 line(s) of Go which triggered the analyzer.
```go
for update := range updates {
msg := update.Message
if update.CallbackQuery != nil {
c.handleCallbackQuery(&update)
continue
}
if (update.Message == nil) && (update.InlineQuery != nil) {
c.handleInlineQuery(&update)
continue
}
if update.Message == nil { // ignore any non-Message Updates
continue
}
if msg.IsCommand() {
c.handleCommand(msg)
if err := c.handleRegisterUserCommand(ctx, msg); err != nil {
log.Println(err)
}
} else {
if c.userStorage.IsAdmin(ctx, msg.From.ID) {
if err := c.handleAdminCommands(ctx, msg); err != nil {
log.Print("cannot handle admin command")
}
}
for _, plug := range c.app.Plugs {
plug.HandleMessages(msg)
}
switch {
case msg.NewChatMembers != nil && len(*msg.NewChatMembers) > 0:
c.handleJoinMembers(
msg,
)
case msg.LeftChatMember != nil:
if err := c.handleLeftMembers(msg); err != nil {
log.Println(err)
}
}
}
}
```
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 {
"(handleCallbackQuery, 1)" -> {"(HandleCallbackQuery, 1)";}
"(HandleCallbackQuery, 1)" -> {"(HandleNewShopCallbackQuery, 1)";"(HandleCaravanCallbackQuery, 1)";}
"(HandleNewShopCallbackQuery, 1)" -> {}
"(HandleCaravanCallbackQuery, 1)" -> {"(RobCaravans, 3)";}
"(RobCaravans, 3)" -> {"(caravansStart, 2)";}
"(caravansStart, 2)" -> {}
}
```
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: 70097f7c289a77b9cd0f87266171fa977763cb3f
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.