github-vet / github-vet/rangeloop-pointer-findings

gibsn/TwitterGoStalker: src/twittergostalker/telegram/bot.go; 19 LoC

Open
#7,574 0 comments 0 reactions 0 assignees View on GitHub
fresh small
Dominant language
No language data
Stars
0
Forks
0
PR merge metrics
PR metrics pending

Description

Found a possible issue in [gibsn/TwitterGoStalker](https://www.github.com/gibsn/TwitterGoStalker) at [src/twittergostalker/telegram/bot.go](https://github.com/gibsn/TwitterGoStalker/blob/f7ed9e5fa4a794136d7a64c6b9af5e4827b6e009/src/twittergostalker/telegram/bot.go#L52-L70)

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 61 may start a goroutine

[Click here to see the code in its original context.](https://github.com/gibsn/TwitterGoStalker/blob/f7ed9e5fa4a794136d7a64c6b9af5e4827b6e009/src/twittergostalker/telegram/bot.go#L52-L70)

Click here to show the 19 line(s) of Go which triggered the analyzer.

```go
for update := range this.updates {
if update.Message == nil {
continue
}

log.Printf("telegram: @%s: %s", update.Message.From.UserName, update.Message.Text)

switch update.Message.Text {
case "/ping":
this.ping(&update)
case "/stalk":
this.stalk(&update)
case "/unstalk":
this.unstalk(&update)
default:
log.Printf("telegram: got unknown command '%s' from @%s\n",
update.Message.Text, update.Message.From.UserName)
}
}

```

Click here to show extra information the analyzer produced.

```
The following paths through the callgraph could lead to a goroutine:
(ping, 1) -> (Send, 1) -> (Call, 5) -> (int32, 1) -> (marshal, 1) -> (WriteString, 1) -> (, 1) -> (GetDataSent, 0) -> (WithDeadline, 2) -> (cancel, 2)
(ping, 1) -> (Send, 1) -> (sendChattable, 1) -> (method, 0) -> (MakeRequest, 2) -> (Println, 2)
(ping, 1) -> (Send, 1) -> (String, 0) -> (HasSuffix, 2) -> (, 0) -> (newStringValueField, 3)
(ping, 1) -> (Send, 1) -> (Call, 5) -> (int32, 1) -> (marshal, 1) -> (WriteString, 1) -> (, 1)
(ping, 1) -> (Send, 1) -> (String, 0) -> (HasSuffix, 2) -> (WriteString, 1) -> (, 1) -> (GetDataSent, 0) -> (WithDeadline, 2) -> (propagateCancel, 2)
(ping, 1) -> (Send, 1) -> (sendChattable, 1) -> (method, 0) -> (string, 1) -> (DecodeRuneInString, 1) -> (, 1) -> (GetDataSent, 0) -> (WithDeadline, 2) -> (cancel, 2)
(ping, 1) -> (Send, 1) -> (String, 0) -> (HasSuffix, 2) -> (WriteByte, 1) -> (writeIndent, 0) -> (Write, 1) -> (GetDataSent, 0) -> (WithDeadline, 2) -> (cancel, 2)
(ping, 1) -> (Send, 1) -> (String, 0) -> (HasSuffix, 2) -> (WriteString, 1) -> (, 1) -> (GetDataSent, 0) -> (WithDeadline, 2) -> (WithDeadline, 2) -> (cancel, 2)
(ping, 1) -> (Send, 1) -> (String, 0) -> (HasSuffix, 2) -> (WriteString, 1) -> (, 1) -> (GetDataSent, 0) -> (WithDeadline, 2) -> (WithCancel, 1) -> (cancel, 2)
(ping, 1) -> (Send, 1) -> (Call, 5) -> (int32, 1) -> (Close, 0)
(ping, 1) -> (Send, 1) -> (sendFile, 1) -> (uploadAndSend, 2) -> (UploadFile, 4) -> (Println, 1)
(ping, 1) -> (Send, 1) -> (Call, 5) -> (int32, 1) -> (, 0) -> (newStringValueField, 3)

```

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: f7ed9e5fa4a794136d7a64c6b9af5e4827b6e009

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.