github-vet / github-vet/rangeloop-pointer-findings
nearmap/kcd: deploy/simple.go; 10 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [nearmap/kcd](https://www.github.com/nearmap/kcd) at [deploy/simple.go](https://github.com/nearmap/kcd/blob/cf56c49d3a5f4ca7eac461ae7ae7341c484e4afd/deploy/simple.go#L89-L98)
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 c is reassigned at line 96
[Click here to see the code in its original context.](https://github.com/nearmap/kcd/blob/cf56c49d3a5f4ca7eac461ae7ae7341c484e4afd/deploy/simple.go#L89-L98)
Click here to show the 10 line(s) of Go which triggered the analyzer.
```go
for _, c := range podSpec.Containers {
if c.Name == sd.kcd.Spec.Container.Name {
if updateErr := target.PatchPodSpec(sd.kcd, c, version); updateErr != nil {
glog.V(2).Infof("Failed to update container version: version=%v, target=%v, error=%v",
version, target.Name(), updateErr)
return updateErr
}
container = &c
}
}
```
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: cf56c49d3a5f4ca7eac461ae7ae7341c484e4afd
Contributor guide
No contributing guide indexed for this repository
Research direction
Read deploy/simple.go around lines 89-98 and inspect how the range-loop variable c is used when container is assigned its address. Compare that behavior with the intended container update flow and the analyzer's finding, then classify the issue as a bug, mitigated, or desirable behavior using the project's stated criteria.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- devops
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100