github-vet / github-vet/rangeloop-pointer-findings
luci/luci-go: luciexe/host/spy.go; 27 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [luci/luci-go](https://www.github.com/luci/luci-go) at [luciexe/host/spy.go](https://github.com/luci/luci-go/blob/29d42a1cf82c36ef694b01ad2fafa22db74f2a9e/luciexe/host/spy.go#L140-L166)
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 build used in defer or goroutine at line 145
[Click here to see the code in its original context.](https://github.com/luci/luci-go/blob/29d42a1cf82c36ef694b01ad2fafa22db74f2a9e/luciexe/host/spy.go#L140-L166)
Click here to show the 27 line(s) of Go which triggered the analyzer.
```go
for build := range in {
go func() {
defer func() {
done <- struct{}{}
}()
out <- build
}()
buildData, err := proto.Marshal(build)
if err != nil {
panic(err)
}
buf.Reset()
z.Reset(&buf)
if _, err := z.Write(buildData); err != nil {
panic(err)
}
if err := z.Close(); err != nil {
panic(err)
}
if err := dgStream.WriteDatagram(buf.Bytes()); err != nil {
panic(err)
}
<-done
}
```
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: 29d42a1cf82c36ef694b01ad2fafa22db74f2a9e
Contributor guide
No contributing guide indexed for this repository
Research direction
Read luci/luci-go/luciexe/host/spy.go around lines 140-166 and inspect the surrounding goroutine and channel flow. Determine whether the analyzer warning represents a real bug, mitigated behavior, or desirable behavior, then leave the corresponding reaction on the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100