github-vet / github-vet/rangeloop-pointer-findings
flanksource/karina: cmd/node.go; 29 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [flanksource/karina](https://www.github.com/flanksource/karina) at [cmd/node.go](https://github.com/flanksource/karina/blob/8b3a429f18c7121025763f5a20bd77149f104b0d/cmd/node.go#L33-L61)
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 node was used in a composite literal at line 55
[Click here to see the code in its original context.](https://github.com/flanksource/karina/blob/8b3a429f18c7121025763f5a20bd77149f104b0d/cmd/node.go#L33-L61)
Click here to show the 29 line(s) of Go which triggered the analyzer.
```go
for _, node := range nodes.Items {
_, isMaster := node.Labels[constants.MasterNodeLabel]
if isMaster {
for k, v := range platform.Master.Annotations {
node.Annotations[k] = v
}
} else {
nodePool, found := node.Labels[constants.NodePoolLabel]
if !found {
continue
}
workerPool, found := platform.Nodes[nodePool]
if !found {
platform.Errorf("Node %s has node pool %s which was not found in platform.Nodes", node.Name, nodePool)
continue
}
annotations := workerPool.Annotations
for k, v := range annotations {
node.Annotations[k] = v
}
}
if _, err := clientset.CoreV1().Nodes().Update(context.TODO(), &node, metav1.UpdateOptions{}); err != nil {
platform.Errorf("Failed to update node %s: %v", node, err)
continue
}
platform.Infof("Node %s annotated", node.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: 8b3a429f18c7121025763f5a20bd77149f104b0d
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.