github-vet / github-vet/rangeloop-pointer-findings
replicatedhq/ship: pkg/lifecycle/daemon/routes_navcycle_completestep.go; 34 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [replicatedhq/ship](https://www.github.com/replicatedhq/ship) at [pkg/lifecycle/daemon/routes_navcycle_completestep.go](https://github.com/replicatedhq/ship/blob/fdc56837f19eef00fa94ef06977d351f30ccb9ed/pkg/lifecycle/daemon/routes_navcycle_completestep.go#L25-L58)
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 step used in defer or goroutine at line 46
[Click here to see the code in its original context.](https://github.com/replicatedhq/ship/blob/fdc56837f19eef00fa94ef06977d351f30ccb9ed/pkg/lifecycle/daemon/routes_navcycle_completestep.go#L25-L58)
Click here to show the 34 line(s) of Go which triggered the analyzer.
```go
for _, step := range d.Release.Spec.Lifecycle.V1 {
stepShared := step.Shared()
stepID := stepShared.ID
if stepID != requestedStep {
continue
}
if ok := d.maybeAbortDueToMissingRequirement(
stepShared.Requires,
c,
requestedStep,
); !ok {
return
}
errChan := make(chan error)
d.StepProgress.Store(stepID, daemontypes.JSONProgress("v2router", map[string]interface{}{
"status": "working",
"message": "working",
}))
go func() {
errChan <- d.StepExecutor(d, step)
}()
// hack, give it 10 ms in case its an instant step. Hydrate and send will read progress from the syncMap
time.Sleep(10 * time.Millisecond)
d.completeMut.Lock()
d.hydrateAndSend(step, c)
go func() {
defer d.completeMut.Unlock()
d.handleAsync(errChan, debug, step, stepID)
}()
return
}
```
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: fdc56837f19eef00fa94ef06977d351f30ccb9ed
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.