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

nitridan/egpuloader: tray.go; 5 LoC

Open
#15,106 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 [nitridan/egpuloader](https://www.github.com/nitridan/egpuloader) at [tray.go](https://github.com/nitridan/egpuloader/blob/5dec0067e0fa1b27e6f649ab02ca5dbad559cefe/tray.go#L153-L157)

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 device at line 155 may start a goroutine

[Click here to see the code in its original context.](https://github.com/nitridan/egpuloader/blob/5dec0067e0fa1b27e6f649ab02ca5dbad559cefe/tray.go#L153-L157)

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

```go
for device := range deviceProvider.monitorDevices(tray.monitorChannel) {
tray.printDevice(&device)
tray.handleAdd(&device)
tray.handleRemove(&device)
}

```

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 {
"(handleAdd, 1)" -> {"(getOrCreateMenuItem, 1)";}
"(getOrCreateMenuItem, 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: 5dec0067e0fa1b27e6f649ab02ca5dbad559cefe

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with tray.go lines 153-157 in the referenced nitridan/egpuloader commit, then inspect the behavior of monitorDevices and handleAdd around the reported reference and possible goroutine. Compare the finding with the linked range-loop guidance and classify it as Bug, Mitigated, or Desirable Behavior; completion is a reaction on this issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.