github-vet / github-vet/rangeloop-pointer-findings

sunlongv520/go-msgserver: utils/rabbitmq/receiver.go; 8 LoC

Open
#14,245 0 comments 0 reactions 0 assignees View on GitHub
fresh tiny
Dominant language
No language data
Stars
0
Forks
0
PR merge metrics
PR metrics pending

Description

Found a possible issue in [sunlongv520/go-msgserver](https://www.github.com/sunlongv520/go-msgserver) at [utils/rabbitmq/receiver.go](https://github.com/sunlongv520/go-msgserver/blob/b2875b31dd4b5d7a55edffbf078455b909ae2dc6/utils/rabbitmq/receiver.go#L109-L116)

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 receiver used in defer or goroutine at line 113

[Click here to see the code in its original context.](https://github.com/sunlongv520/go-msgserver/blob/b2875b31dd4b5d7a55edffbf078455b909ae2dc6/utils/rabbitmq/receiver.go#L109-L116)

Click here to show the 8 line(s) of Go which triggered the analyzer.

```go
for _, receiver := range r.receiverList {
//r.listenReceiver(receiver)
r.wg.Add(1)
go func() {
err = r.listenReceiver(receiver)
}()

}

```

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: b2875b31dd4b5d7a55edffbf078455b909ae2dc6

Contributor guide

No contributing guide indexed for this repository

Research direction

Read utils/rabbitmq/receiver.go at lines 109-116 and inspect how the range-loop variable is used by the goroutine. Compare the analyzer report with the surrounding receiver behavior, then classify the finding as Bug, Mitigated, or Desirable Behavior using the linked guidance. Done means leaving the appropriate reaction on the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend, distributed-systems
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.