github-vet / github-vet/rangeloop-pointer-findings
ConsenSys/eth2stats-server: api/wsclient/wsclient.go; 25 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [ConsenSys/eth2stats-server](https://www.github.com/ConsenSys/eth2stats-server) at [api/wsclient/wsclient.go](https://github.com/ConsenSys/eth2stats-server/blob/78bbe0b10cb11fce4955c52c06412ed41213cf95/api/wsclient/wsclient.go#L46-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.
> range-loop variable msg used in defer or goroutine at line 52
[Click here to see the code in its original context.](https://github.com/ConsenSys/eth2stats-server/blob/78bbe0b10cb11fce4955c52c06412ed41213cf95/api/wsclient/wsclient.go#L46-L70)
Click here to show the 25 line(s) of Go which triggered the analyzer.
```go
for msg := range c.dataChan {
log.Trace("[sender] got message to send")
errChan := make(chan error)
go func() {
err := c.conn.WriteJSON(msg)
errChan <- err
}()
select {
case err := <-errChan:
if err != nil {
log.Warn(err)
c.close.Done()
return
}
log.Trace("[sender] message sent")
case <-time.After(5 * time.Second):
log.Warn("[sender] timeout reached; message not sent")
c.close.Done()
return
}
}
```
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: 78bbe0b10cb11fce4955c52c06412ed41213cf95
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.