github-vet / github-vet/rangeloop-pointer-findings
yp-engineering/docker-events-hook: docker-events-hook.go; 41 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [yp-engineering/docker-events-hook](https://www.github.com/yp-engineering/docker-events-hook) at [docker-events-hook.go](https://github.com/yp-engineering/docker-events-hook/blob/c6b31b080e5ec8227ee7c911a5d840e543123ff3/docker-events-hook.go#L147-L187)
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 plugin used in defer or goroutine at line 161
[Click here to see the code in its original context.](https://github.com/yp-engineering/docker-events-hook/blob/c6b31b080e5ec8227ee7c911a5d840e543123ff3/docker-events-hook.go#L147-L187)
Click here to show the 41 line(s) of Go which triggered the analyzer.
```go
for plugin, name := range plugins {
go func() {
var result string
var pluginError error
inspect, err := dockerInspect(event)
if err != nil {
glog.Errorf("couldn't inspect event: %#v", event)
return
}
call := "Api." + strings.Title(event.Status)
switch event.Status {
case "attach":
pluginError = plugin.Call(call, inspect, &result)
case "create":
pluginError = plugin.Call(call, inspect, &result)
case "delete":
pluginError = plugin.Call(call, event, &result)
case "destroy":
pluginError = plugin.Call(call, event, &result)
case "die":
pluginError = plugin.Call(call, inspect, &result)
case "kill":
pluginError = plugin.Call(call, inspect, &result)
case "resize":
pluginError = plugin.Call(call, inspect, &result)
case "start":
pluginError = plugin.Call(call, inspect, &result)
case "untag":
pluginError = plugin.Call(call, event, &result)
default:
glog.Errorf("unknown event: %v", event)
}
eventInfo(event, name, inspect, result, call)
if pluginError != nil {
glog.Errorf("plugin error: %#v", pluginError)
}
}()
}
```
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: c6b31b080e5ec8227ee7c911a5d840e543123ff3
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.