github-vet / github-vet/rangeloop-pointer-findings
FoundationDB/fdb-kubernetes-operator: controllers/admin_client.go; 46 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [FoundationDB/fdb-kubernetes-operator](https://www.github.com/FoundationDB/fdb-kubernetes-operator) at [controllers/admin_client.go](https://github.com/FoundationDB/fdb-kubernetes-operator/blob/e57ad80731c7c4962a533a1c533477d75ae57e6b/controllers/admin_client.go#L739-L784)
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 pod was used in a composite literal at line 741
[Click here to see the code in its original context.](https://github.com/FoundationDB/fdb-kubernetes-operator/blob/e57ad80731c7c4962a533a1c533477d75ae57e6b/controllers/admin_client.go#L739-L784)
Click here to show the 46 line(s) of Go which triggered the analyzer.
```go
for _, pod := range pods.Items {
ip := MockPodIP(&pod)
podClient := &mockFdbPodClient{Cluster: client.Cluster, Pod: &pod}
processCount, err := getStorageServersPerPodForPod(&pod)
if err != nil {
return nil, err
}
for processIndex := 1; processIndex <= processCount; processIndex++ {
fullAddress := client.Cluster.GetFullAddress(ip, processIndex)
_, ipExcluded := exclusionMap[ip]
_, addressExcluded := exclusionMap[fullAddress]
excluded := ipExcluded || addressExcluded
_, isCoordinator := coordinators[fullAddress]
if isCoordinator && !excluded {
coordinators[fullAddress] = true
}
instance := newFdbInstance(pod)
command, err := GetStartCommand(client.Cluster, instance, podClient, processIndex, processCount)
if err != nil {
return nil, err
}
locality := map[string]string{
"instance_id": instance.GetInstanceID(),
"zoneid": pod.Name,
"dcid": client.Cluster.Spec.DataCenter,
}
if processCount > 1 {
locality["process_id"] = fmt.Sprintf("%s-%d", instance.GetInstanceID(), processIndex)
}
status.Cluster.Processes[fmt.Sprintf("%s-%d", pod.Name, processIndex)] = fdbtypes.FoundationDBStatusProcessInfo{
Address: fullAddress,
ProcessClass: GetProcessClassFromMeta(pod.ObjectMeta),
CommandLine: command,
Excluded: excluded,
Locality: locality,
Version: client.Cluster.Status.RunningVersion,
UptimeSeconds: 60000,
}
}
}
```
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: e57ad80731c7c4962a533a1c533477d75ae57e6b
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.