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

bradfitz/fotobilder-spiegel: spiegel.go; 5 LoC

Open
#18,030 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 [bradfitz/fotobilder-spiegel](https://www.github.com/bradfitz/fotobilder-spiegel) at [spiegel.go](https://github.com/bradfitz/fotobilder-spiegel/blob/13ad99f0a1a7858a71607041ce2ac9e911fe0e54/spiegel.go#L279-L283)

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 item at line 282 may start a goroutine

[Click here to see the code in its original context.](https://github.com/bradfitz/fotobilder-spiegel/blob/13ad99f0a1a7858a71607041ce2ac9e911fe0e54/spiegel.go#L279-L283)

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

```go
for _, item := range mediaSet.MediaSetItems.MediaSetItem {
item.key = findKey(item.InfoURL, picPattern)
//log.Printf(" pic: %s", item.InfoURL)
notePhoto(&item)
}

```

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 {
"(notePhoto, 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: 13ad99f0a1a7858a71607041ce2ac9e911fe0e54

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with spiegel.go lines 279-283, then inspect notePhoto and the surrounding call path to determine whether the reference to the range variable can escape or trigger concurrent behavior. Compare that behavior with the analyzer report and classify the finding as Bug, Mitigated, or Desirable Behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.