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

mindreframer/golang-devops-stuff: src/github.com/TheRealBill/redskull/actions/constellation.go; 34 LoC

Open
#18,251 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 [mindreframer/golang-devops-stuff](https://www.github.com/mindreframer/golang-devops-stuff) at [src/github.com/TheRealBill/redskull/actions/constellation.go](https://github.com/mindreframer/golang-devops-stuff/blob/bb6c6c16ff0ae7892cd0ed0715b8a6b769052f9f/src/github.com/TheRealBill/redskull/actions/constellation.go#L704-L737)

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

[Click here to see the code in its original context.](https://github.com/mindreframer/golang-devops-stuff/blob/bb6c6c16ff0ae7892cd0ed0715b8a6b769052f9f/src/github.com/TheRealBill/redskull/actions/constellation.go#L704-L737)

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

```go
for _, pod := range pods {
if pod.Name == "" {
log.Print("WUT: Have a nameless pod. This is probably a bug.")
continue
}
_, islocal := c.LocalPodMap[pod.Name]
if islocal {
log.Print("Skipping local pod")
continue
}
_, isremote := c.RemotePodMap[pod.Name]
if isremote {
log.Print("Skipping known remote pod")
continue
}
log.Print("Adding DISCOVERED remotely managed pod " + pod.Name)
c.GetPodAuth(pod.Name)
log.Print("Got auth for pod")
c.LoadNodesForPod(&pod, &sentinel)
newsentinels, _ := sentinel.GetSentinels(pod.Name)
pod.SentinelCount = len(newsentinels)
c.PodToSentinelsMap[pod.Name] = newsentinels
c.RemotePodMap[pod.Name] = &pod
for _, ns := range newsentinels {
_, known := c.RemoteSentinels[ns.Name]
if known {
continue
}
if ns.Name == c.LocalSentinel.Name || ns.Name == sentinel.Name {
continue
}
c.AddSentinelByAddress(ns.Name)
}
}

```

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: bb6c6c16ff0ae7892cd0ed0715b8a6b769052f9f

Contributor guide

No contributing guide indexed for this repository

Research direction

Read src/github.com/TheRealBill/redskull/actions/constellation.go around lines 704-737 and inspect the analyzer message about the reference to pod being reassigned at line 726. Determine whether the reported behavior is a bug, mitigated, or desirable behavior, then leave the corresponding reaction on the issue.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.