github-vet / github-vet/rangeloop-pointer-findings
unixliang/go-svrkit: run.go; 22 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [unixliang/go-svrkit](https://www.github.com/unixliang/go-svrkit) at [run.go](https://github.com/unixliang/go-svrkit/blob/415bd4f4b2c5ecbf66484b9aa7dcf073e5a9e5aa/run.go#L17-L38)
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 local used in defer or goroutine at line 27
[Click here to see the code in its original context.](https://github.com/unixliang/go-svrkit/blob/415bd4f4b2c5ecbf66484b9aa7dcf073e5a9e5aa/run.go#L17-L38)
Click here to show the 22 line(s) of Go which triggered the analyzer.
```go
for _, local := range liLocal {
wg.Add(1)
go func() {
defer func() {
if err := recover(); err != nil {
fmt.Println(err)
}
}()
for {
bytes := make([]byte, MAX_PKG_LEN)
n, addr, err := local.Conn.ReadFromUDP(bytes)
if err != nil {
panic(err)
}
seq := <-seqAlloc
req := bytes[0:n]
go local.Logic(seq, local.Conn, req, addr)
}
}()
}
```
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: 415bd4f4b2c5ecbf66484b9aa7dcf073e5a9e5aa
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.