github-vet / github-vet/rangeloop-pointer-findings
yametech/nuwa: controllers/water_controller.go; 20 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [yametech/nuwa](https://www.github.com/yametech/nuwa) at [controllers/water_controller.go](https://github.com/yametech/nuwa/blob/b332d8ff65d55c8bca78205c78b7d23505c1155a/controllers/water_controller.go#L285-L304)
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 was used in a composite literal at line 289
[Click here to see the code in its original context.](https://github.com/yametech/nuwa/blob/b332d8ff65d55c8bca78205c78b7d23505c1155a/controllers/water_controller.go#L285-L304)
Click here to show the 20 line(s) of Go which triggered the analyzer.
```go
for _, c := range tmp1 {
if nuwav1.In(tmp1, c) && !nuwav1.In(tmp2, c) {
objKey := client.ObjectKey{
Namespace: instance.Namespace,
Name: deploymentName(coordinateName(&c), instance),
}
deployment := &appsv1.Deployment{}
err := r.Client.Get(ctx, objKey, deployment)
if errors.IsNotFound(err) {
continue
}
if err != nil {
return error_stack.WithStack(err)
}
err = r.Client.Delete(ctx, deployment)
if err != nil {
return error_stack.WithStack(err)
}
}
}
```
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: b332d8ff65d55c8bca78205c78b7d23505c1155a
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.