github-vet / github-vet/rangeloop-pointer-findings
ev3go/ev3dev: motorutil/steer.go; 22 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [ev3go/ev3dev](https://www.github.com/ev3go/ev3dev) at [motorutil/steer.go](https://github.com/ev3go/ev3dev/blob/8dac9dc96a47a31345255ef1ab871db47016ef7c/motorutil/steer.go#L296-L317)
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 motor used in defer or goroutine at line 311
[Click here to see the code in its original context.](https://github.com/ev3go/ev3dev/blob/8dac9dc96a47a31345255ef1ab871db47016ef7c/motorutil/steer.go#L296-L317)
Click here to show the 22 line(s) of Go which triggered the analyzer.
```go
for i, motor := range []struct {
side string
device *ev3dev.TachoMotor
}{
{side: "left", device: s.Left},
{side: "right", device: s.Right},
} {
i := i
side := motor.side
device := motor.device
wg.Add(1)
go func() {
defer wg.Done()
stat, ok, err := ev3dev.Wait(device, ev3dev.Running, 0, 0, false, s.Timeout)
if err != nil {
errors[i] = waitError{side: side, motor: device, cause: err}
}
if !ok {
errors[i] = waitError{side: side, motor: device, cause: timeoutError(s.Timeout), stat: stat}
}
}()
}
```
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: 8dac9dc96a47a31345255ef1ab871db47016ef7c
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.