github-vet / github-vet/rangeloop-pointer-findings
declanshanaghy/bbqberry: backend/temperatures.go; 13 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [declanshanaghy/bbqberry](https://www.github.com/declanshanaghy/bbqberry) at [backend/temperatures.go](https://github.com/declanshanaghy/bbqberry/blob/13dad8c1c887e001f863313ad2aa6adb49c1b608/backend/temperatures.go#L15-L27)
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 probeNumber was used in a composite literal at line 25
[Click here to see the code in its original context.](https://github.com/declanshanaghy/bbqberry/blob/13dad8c1c887e001f863313ad2aa6adb49c1b608/backend/temperatures.go#L15-L27)
Click here to show the 13 line(s) of Go which triggered the analyzer.
```go
for _, probeNumber := range getProbeIndexes(params.Probe) {
probe := framework.Config.Hardware.Probes[probeNumber]
if *probe.Enabled {
reading, err := tReader.GetTemperatureReading(probeNumber)
if err != nil {
return nil, err
}
readings = append(readings, reading)
} else {
readings = append(readings, &models.TemperatureReading{Probe:&probeNumber})
}
}
```
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: 13dad8c1c887e001f863313ad2aa6adb49c1b608
Contributor guide
No contributing guide indexed for this repository
Research direction
Read backend/temperatures.go lines 15-27 and inspect how probeNumber is used in the TemperatureReading composite literal inside the range loop. Check the analyzer's concern about referencing the range variable, then determine whether the behavior is a Bug, Mitigated, or Desirable Behavior and leave the corresponding reaction.
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
- 45/100