github-vet / github-vet/rangeloop-pointer-findings
HaoKunT/HKComm: hkcmd/HKComm/community.go; 31 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [HaoKunT/HKComm](https://www.github.com/HaoKunT/HKComm) at [hkcmd/HKComm/community.go](https://github.com/HaoKunT/HKComm/blob/d40d12247406459987090dff2000f973444e5079/hkcmd/HKComm/community.go#L227-L257)
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.
> reference to msgOut was used in a composite literal at line 254
[Click here to see the code in its original context.](https://github.com/HaoKunT/HKComm/blob/d40d12247406459987090dff2000f973444e5079/hkcmd/HKComm/community.go#L227-L257)
Click here to show the 31 line(s) of Go which triggered the analyzer.
```go
for msgOut := range msgOutCh {
// 前期判断检查全部完成
// 将消息送入消息队列,首先序列化对象为json
msgJson, err := json.Marshal(msgOut)
if checkError(err) != nil {
continue
}
// publish至HKComm这个exchange
err = chAMQP.Publish(
"hkcomm",
"hkcomm.msg",
false,
false,
amqp.Publishing{
ContentType: "text/plain",
Body: msgJson,
})
if checkError(err) != nil {
continue
}
// 将confirm同步位加1
atomic.AddUint64(&syncTag, 1)
// 将离线同步结构置入离线确认队列中
Confirm <- &unConfirmTag{
msgOut.Sync,
msgOut.connection,
syncTag,
&msgOut,
}
}
```
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: d40d12247406459987090dff2000f973444e5079
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.