github-vet / github-vet/rangeloop-pointer-findings
aws/amazon-ssm-agent: agent/longrunning/manager/coremodule.go; 17 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [aws/amazon-ssm-agent](https://www.github.com/aws/amazon-ssm-agent) at [agent/longrunning/manager/coremodule.go](https://github.com/aws/amazon-ssm-agent/blob/4fb43c808580144c0463cb298e111bd0979e0ff5/agent/longrunning/manager/coremodule.go#L297-L313)
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 pluginName used in defer or goroutine at line 304
[Click here to see the code in its original context.](https://github.com/aws/amazon-ssm-agent/blob/4fb43c808580144c0463cb298e111bd0979e0ff5/agent/longrunning/manager/coremodule.go#L297-L313)
Click here to show the 17 line(s) of Go which triggered the analyzer.
```go
for pluginName := range m.runningPlugins {
go func(wgc *sync.WaitGroup, i int) {
if stopType == contracts.StopTypeSoftStop {
wgc.Add(1)
defer wgc.Done()
}
plugin := m.registeredPlugins[pluginName]
if err := plugin.Handler.Stop(m.context, task.NewChanneledCancelFlag()); err != nil {
log.Errorf("Plugin (%v) failed to stop with error: %v",
pluginName,
err)
}
}(&wg, i)
i++
}
```
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: 4fb43c808580144c0463cb298e111bd0979e0ff5
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.