github-vet / github-vet/rangeloop-pointer-findings
coinexchain/onvakv: store/fuzz/fuzz.go; 29 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [coinexchain/onvakv](https://www.github.com/coinexchain/onvakv) at [store/fuzz/fuzz.go](https://github.com/coinexchain/onvakv/blob/19f53210214c60f123d3b6d3229feff48417df1c/store/fuzz/fuzz.go#L564-L592)
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 i used in defer or goroutine at line 578
[Click here to see the code in its original context.](https://github.com/coinexchain/onvakv/blob/19f53210214c60f123d3b6d3229feff48417df1c/store/fuzz/fuzz.go#L564-L592)
Click here to show the 29 line(s) of Go which triggered the analyzer.
```go
for i, epoch := range block.EpochList {
if DBG {fmt.Printf("Check h:%d (%v) epoch %d of %d\n", height, block.Succeed, i, len(block.EpochList))}
dbList := make([]storetypes.MultiStoreI, len(epoch.TxList))
var wg sync.WaitGroup
for j, tx := range epoch.TxList {
if cfg.TestRabbit {
dbList[j] = rabbit.NewRabbitStore(trunk)
} else {
dbList[j] = trunk.Cached()
}
if DBG {fmt.Printf("Check h:%d (%v) epoch %d tx %d (%v) of %d\n", height, block.Succeed, i, j, tx.Succeed, len(epoch.TxList))}
if inParallel {
wg.Add(1)
go func(tx *Tx, j int) {
CheckTx(height, i, j, dbList[j], tx, rs, cfg, block.Succeed)
wg.Done()
}(tx, j)
} else {
CheckTx(height, i, j, dbList[j], tx, rs, cfg, block.Succeed)
}
}
if inParallel {wg.Wait()}
for j, tx := range epoch.TxList {
if DBG {fmt.Printf("WriteBack %d-%d tx %d : %v\n", height, i, j, tx.Succeed)}
dbList[j].Close(tx.Succeed)
//showTrunk(trunk, i, j, tx.Succeed, block.Succeed)
}
}
```
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: 19f53210214c60f123d3b6d3229feff48417df1c
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.