github-vet / github-vet/rangeloop-pointer-findings
lpetrea/jenkins-x: pkg/jx/cmd/create_devpod.go; 16 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [lpetrea/jenkins-x](https://www.github.com/lpetrea/jenkins-x) at [pkg/jx/cmd/create_devpod.go](https://github.com/lpetrea/jenkins-x/blob/687267595ef61c88f21fa935c542ccf2f7ec7d5a/pkg/jx/cmd/create_devpod.go#L978-L993)
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 p is reassigned at line 989
[Click here to see the code in its original context.](https://github.com/lpetrea/jenkins-x/blob/687267595ef61c88f21fa935c542ccf2f7ec7d5a/pkg/jx/cmd/create_devpod.go#L978-L993)
Click here to show the 16 line(s) of Go which triggered the analyzer.
```go
for _, p := range podsList.Items {
ann := p.Annotations
if ann == nil {
ann = map[string]string{}
}
// if syncing only match DevPods using the same local dir otherwise ignore any devpods with a local dir sync
matchDir := dir
if !o.Sync {
matchDir = ""
}
if p.DeletionTimestamp == nil && ann[kube.AnnotationLocalDir] == matchDir {
pod = &p
o.NotifyProgress(opts.LogInfo, "Reusing pod %s - waiting for it to be ready...\n", util.ColorInfo(pod.Name))
return pod, nil
}
}
```
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: 687267595ef61c88f21fa935c542ccf2f7ec7d5a
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reading pkg/jx/cmd/create_devpod.go around lines 978-993 and the surrounding create-devpod flow. Check how the range-loop variable is referenced when the pod is reused; done means the analyzer finding is corrected or its behavior is documented as mitigated or desirable.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100