github-vet / github-vet/rangeloop-pointer-findings
longhorn/longhorn-manager: upgrade/v102to110/upgrade.go; 21 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [longhorn/longhorn-manager](https://www.github.com/longhorn/longhorn-manager) at [upgrade/v102to110/upgrade.go](https://github.com/longhorn/longhorn-manager/blob/24300a52841e7f66b6568e05c327b2797df8abca/upgrade/v102to110/upgrade.go#L221-L241)
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 ds is reassigned at line 222
[Click here to see the code in its original context.](https://github.com/longhorn/longhorn-manager/blob/24300a52841e7f66b6568e05c327b2797df8abca/upgrade/v102to110/upgrade.go#L221-L241)
Click here to show the 21 line(s) of Go which triggered the analyzer.
```go
for _, ds := range daemonsetList.Items {
dsp := &ds
needToUpdate, err := needToUpdateTolerationAnnotation(dsp)
if err != nil {
return err
}
if !needToUpdate {
continue
}
appliedTolerations := getNonDefaultTolerationList(dsp.Spec.Template.Spec.Tolerations)
appliedTolerationsByte, err := json.Marshal(appliedTolerations)
if err != nil {
return err
}
if err := util.SetAnnotation(dsp, types.GetLonghornLabelKey(types.LastAppliedTolerationAnnotationKeySuffix), string(appliedTolerationsByte)); err != nil {
return err
}
if _, err := kubeClient.AppsV1().DaemonSets(namespace).Update(dsp); err != nil {
return 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: 24300a52841e7f66b6568e05c327b2797df8abca
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.