github-vet / github-vet/rangeloop-pointer-findings

NetApp/trident: operator/controllers/provisioner/installer/installer.go; 16 LoC

Open
#15,710 0 comments 0 reactions 0 assignees View on GitHub
fresh small
Dominant language
No language data
Stars
0
Forks
0
PR merge metrics
PR metrics pending

Description

Found a possible issue in [NetApp/trident](https://www.github.com/NetApp/trident) at [operator/controllers/provisioner/installer/installer.go](https://github.com/NetApp/trident/blob/62ab24d23195b6616334fb7d17fe4a629dda67fe/operator/controllers/provisioner/installer/installer.go#L1560-L1575)

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 daemonset is reassigned at line 1566

[Click here to see the code in its original context.](https://github.com/NetApp/trident/blob/62ab24d23195b6616334fb7d17fe4a629dda67fe/operator/controllers/provisioner/installer/installer.go#L1560-L1575)

Click here to show the 16 line(s) of Go which triggered the analyzer.

```go
for _, daemonset := range daemonsets {
if daemonset.Namespace == i.namespace && daemonset.Name == daemonsetName {
// Found a daemonset named in the same namespace
log.Infof("A Trident daemonset named '%s' was found by label in CR namespace '%s'.", daemonsetName,
i.namespace)

currentDaemonset = &daemonset
createDaemonset = false
} else {
log.Errorf("a Trident daemonset %s was found by label in namespace '%s', "+
"which does not meet either name %s or namespace '%s' requirement, marking it for deletion",
daemonset.Name, daemonset.Namespace, daemonsetName, i.namespace)

unwantedDaemonsets = append(unwantedDaemonsets, daemonset)
}
}

```

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: 62ab24d23195b6616334fb7d17fe4a629dda67fe

Contributor guide

No contributing guide indexed for this repository

Research direction

Open operator/controllers/provisioner/installer/installer.go around lines 1560-1575 at commit 62ab24d. Read the loop and the linked analyzer context to determine whether the reported range-loop pointer finding is a bug, mitigated, or desirable behavior. Done means leaving the corresponding classification reaction on the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
infrastructure
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.