github-vet / github-vet/rangeloop-pointer-findings
mit-dci/opencx: cxauctionserver/auctionserver.go; 13 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [mit-dci/opencx](https://www.github.com/mit-dci/opencx) at [cxauctionserver/auctionserver.go](https://github.com/mit-dci/opencx/blob/0b5ba4ecefdedca708114d85d29f6e98054fce9e/cxauctionserver/auctionserver.go#L292-L304)
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 id used in defer or goroutine at line 295
[Click here to see the code in its original context.](https://github.com/mit-dci/opencx/blob/0b5ba4ecefdedca708114d85d29f6e98054fce9e/cxauctionserver/auctionserver.go#L292-L304)
Click here to show the 13 line(s) of Go which triggered the analyzer.
```go
for id, _ := range activeAuctions {
go func() {
var batchChan chan *match.AuctionBatch
if batchChan, err = batcher.EndAuction(id); err != nil {
err = fmt.Errorf("Error ending auction for StopClockAndWait: %s", err)
return
}
<-batchChan
close(batchChan)
doneChan <- true
}()
num++
}
```
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: 0b5ba4ecefdedca708114d85d29f6e98054fce9e
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with cxauctionserver/auctionserver.go at lines 292-304, especially the range over activeAuctions and the goroutine calling EndAuction. Trace the surrounding auction shutdown flow and run the repository's available tests; done means the reported range-loop capture issue is addressed without changing the intended auction-ending behavior.
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