github-vet / github-vet/rangeloop-pointer-findings
kubeedge/examples: kubeedge-counter-demo/vendor/github.com/kubeedge/kubeedge/edge/pkg/edged/edged.go; 3 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [kubeedge/examples](https://www.github.com/kubeedge/examples) at [kubeedge-counter-demo/vendor/github.com/kubeedge/kubeedge/edge/pkg/edged/edged.go](https://github.com/kubeedge/examples/blob/cc38a1a06c71de7390a77b445ae13e2f71dffa42/kubeedge-counter-demo/vendor/github.com/kubeedge/kubeedge/edge/pkg/edged/edged.go#L975-L977)
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.
> function call which takes a reference to list at line 976 may start a goroutine
[Click here to see the code in its original context.](https://github.com/kubeedge/examples/blob/cc38a1a06c71de7390a77b445ae13e2f71dffa42/kubeedge-counter-demo/vendor/github.com/kubeedge/kubeedge/edge/pkg/edged/edged.go#L975-L977)
Click here to show the 3 line(s) of Go which triggered the analyzer.
```go
for _, list := range lists {
e.addPod(&list)
}
```
Click here to show extra information the analyzer produced.
```
The following graphviz dot graph describes paths through the callgraph that could lead to a function calling a goroutine:
digraph G {
"(New, 1)" -> {"(get, 1)";}
"(insertCert, 4)" -> {"(New, 1)";}
"(get, 1)" -> {"(SetTransportDefaults, 1)";}
"(configureTransport, 1)" -> {"(addConnIfNeeded, 3)";}
"(ConfigureTransport, 1)" -> {"(configureTransport, 1)";}
"(addConnIfNeeded, 3)" -> {}
"(addPod, 1)" -> {"(Add, 1)";}
"(Add, 1)" -> {"(New, 1)";"(insertCert, 4)";"(NewCertSigner, 2)";}
"(NewCertSigner, 2)" -> {"(New, 1)";}
"(SetTransportDefaults, 1)" -> {"(ConfigureTransport, 1)";}
}
```
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: cc38a1a06c71de7390a77b445ae13e2f71dffa42
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at kubeedge-counter-demo/vendor/github.com/kubeedge/kubeedge/edge/pkg/edged/edged.go lines 975-977 and inspect addPod, using the analyzer report to understand the reference passed from the range loop. Confirm the intended handling of list and verify that this finding is no longer reported.
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
- Mostly clear
- Newbie friendliness
- 48/100