github-vet / github-vet/rangeloop-pointer-findings
robinsonking/hcAdapter: hc-adapter/hc/blockscanner_orign.go; 26 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [robinsonking/hcAdapter](https://www.github.com/robinsonking/hcAdapter) at [hc-adapter/hc/blockscanner_orign.go](https://github.com/robinsonking/hcAdapter/blob/5f3e4f5f322f8c705afd922c528acceffa9d1394/hc-adapter/hc/blockscanner_orign.go#L251-L276)
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 txid used in defer or goroutine at line 266
[Click here to see the code in its original context.](https://github.com/robinsonking/hcAdapter/blob/5f3e4f5f322f8c705afd922c528acceffa9d1394/hc-adapter/hc/blockscanner_orign.go#L251-L276)
Click here to show the 26 line(s) of Go which triggered the analyzer.
```go
for _, txid := range mTxs {
bs.extractingCH <- struct{}{}
//shouldDone++
go func(mTxid string, end chan struct{}, mProducer chan<- interface{}) {
//释放
defer func() {
<-end
}()
result := &ExtractTxOriginResult{
Success: true,
}
//导出提出的交易
trx, err := bs.wm.GetTransaction(txid)
if err != nil {
bs.wm.Log.Std.Info("block scanner get transaction txid: %s failed, err: %v", txid, err)
result.Success = false
}
result.Tx = trx
mProducer <- result
}(txid, bs.extractingCH, eProducer)
}
```
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: 5f3e4f5f322f8c705afd922c528acceffa9d1394
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.