github-vet / github-vet/rangeloop-pointer-findings
projectatomic/atomic-enterprise: pkg/deploy/controller/deploymentconfig/controller.go; 34 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [projectatomic/atomic-enterprise](https://www.github.com/projectatomic/atomic-enterprise) at [pkg/deploy/controller/deploymentconfig/controller.go](https://github.com/projectatomic/atomic-enterprise/blob/fe3f07ee509de38099565693aecc74e555f971ee/pkg/deploy/controller/deploymentconfig/controller.go#L67-L100)
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.
>
[Click here to see the code in its original context.](https://github.com/projectatomic/atomic-enterprise/blob/fe3f07ee509de38099565693aecc74e555f971ee/pkg/deploy/controller/deploymentconfig/controller.go#L67-L100)
Click here to show the 34 line(s) of Go which triggered the analyzer.
```go
for _, deployment := range existingDeployments.Items {
// check if this is the latest deployment
// we'll return after we've dealt with the multiple-active-deployments case
if deployutil.DeploymentVersionFor(&deployment) == config.LatestVersion {
latestDeploymentExists = true
}
deploymentStatus := deployutil.DeploymentStatusFor(&deployment)
switch deploymentStatus {
case deployapi.DeploymentStatusFailed,
deployapi.DeploymentStatusComplete:
// Previous deployment in terminal state - can ignore
// Ignoring specific deployment states so that any newly introduced
// deployment state will not be ignored
default:
if inflightDeployment == nil {
inflightDeployment = &deployment
continue
}
var deploymentForCancellation *kapi.ReplicationController
if deployutil.DeploymentVersionFor(inflightDeployment) < deployutil.DeploymentVersionFor(&deployment) {
deploymentForCancellation, inflightDeployment = inflightDeployment, &deployment
} else {
deploymentForCancellation = &deployment
}
deploymentForCancellation.Annotations[deployapi.DeploymentCancelledAnnotation] = deployapi.DeploymentCancelledAnnotationValue
deploymentForCancellation.Annotations[deployapi.DeploymentStatusReasonAnnotation] = deployapi.DeploymentCancelledNewerDeploymentExists
if _, err := c.deploymentClient.updateDeployment(deploymentForCancellation.Namespace, deploymentForCancellation); err != nil {
util.HandleError(fmt.Errorf("couldn't cancel Deployment %s: %v", deployutil.LabelForDeployment(deploymentForCancellation), err))
}
glog.V(4).Infof("Cancelled Deployment %s for DeploymentConfig %s", deployutil.LabelForDeployment(deploymentForCancellation), deployutil.LabelForDeploymentConfig(config))
}
}
```
Click here to show extra information the analyzer produced.
```
No path was found through the callgraph that could lead to a function which writes a pointer argument.
No path was found through the callgraph that could lead to a function which passes a pointer to third-party code.
root signature {DeploymentVersionFor 1} was not found in the callgraph; reference was passed directly to third-party code
```
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: fe3f07ee509de38099565693aecc74e555f971ee
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.