github-vet / github-vet/rangeloop-pointer-findings
ninedraft/sticker2img: sticker2img.go; 21 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [ninedraft/sticker2img](https://www.github.com/ninedraft/sticker2img) at [sticker2img.go](https://github.com/ninedraft/sticker2img/blob/a8a8192f0aca855a9c36e4b2c318a5ba2cec54fa/sticker2img.go#L47-L67)
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 59
[Click here to see the code in its original context.](https://github.com/ninedraft/sticker2img/blob/a8a8192f0aca855a9c36e4b2c318a5ba2cec54fa/sticker2img.go#L47-L67)
Click here to show the 21 line(s) of Go which triggered the analyzer.
```go
for update := range updates {
if update.Message == nil || !update.Message.Chat.IsPrivate() {
continue
}
if update.Message.Sticker != nil {
log.Printf("@%s: %q\n", update.Message.From.UserName, update.Message.Sticker.Emoji)
go ProcessSticker(bot, *update.Message)
}
if update.Message.Command() == "start" {
go func() {
repl := tgbotapi.NewMessage(update.Message.Chat.ID, "Hi!\nSend me a sticker and I'll return you a photo and a PNG image!")
repl.ReplyToMessageID = update.Message.MessageID
_, err := bot.Send(repl)
if err != nil {
log.Printf("error while sending 'hello' message: %v\n", err)
}
}()
}
}
```
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: a8a8192f0aca855a9c36e4b2c318a5ba2cec54fa
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.