github-vet / github-vet/rangeloop-pointer-findings
pacslab/DockerMV: go/src/github.com/docker/docker/vendor/github.com/docker/swarmkit/manager/allocator/allocator.go; 38 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [pacslab/DockerMV](https://www.github.com/pacslab/DockerMV) at [go/src/github.com/docker/docker/vendor/github.com/docker/swarmkit/manager/allocator/allocator.go](https://github.com/pacslab/DockerMV/blob/06c03df00b59a415804baa8746aa1690d0e52f5b/go/src/github.com/docker/docker/vendor/github.com/docker/swarmkit/manager/allocator/allocator.go#L97-L134)
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 aa is reassigned at line 109
[Click here to see the code in its original context.](https://github.com/pacslab/DockerMV/blob/06c03df00b59a415804baa8746aa1690d0e52f5b/go/src/github.com/docker/docker/vendor/github.com/docker/swarmkit/manager/allocator/allocator.go#L97-L134)
Click here to show the 38 line(s) of Go which triggered the analyzer.
```go
for _, aa := range []allocActor{
{
taskVoter: networkVoter,
init: a.doNetworkInit,
action: a.doNetworkAlloc,
},
} {
if aa.taskVoter != "" {
a.registerToVote(aa.taskVoter)
}
// Assign a pointer for variable capture
aaPtr := &aa
actor := func() error {
wg.Add(1)
defer wg.Done()
// init might return an allocator specific context
// which is a child of the passed in context to hold
// allocator specific state
watch, watchCancel, err := a.init(ctx, aaPtr)
if err != nil {
return err
}
wg.Add(1)
go func(watch <-chan events.Event, watchCancel func()) {
defer func() {
wg.Done()
watchCancel()
}()
a.run(ctx, *aaPtr, watch)
}(watch, watchCancel)
return nil
}
actors = append(actors, actor)
}
```
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: 06c03df00b59a415804baa8746aa1690d0e52f5b
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.