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

openshift/gatekeeper: pkg/readiness/ready_tracker.go; 24 LoC

Open
#13,703 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 [openshift/gatekeeper](https://www.github.com/openshift/gatekeeper) at [pkg/readiness/ready_tracker.go](https://github.com/openshift/gatekeeper/blob/1fb8db0b4d81cd366a56808f950c3d6f8719f658/pkg/readiness/ready_tracker.go#L353-L376)

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.

>

[Click here to see the code in its original context.](https://github.com/openshift/gatekeeper/blob/1fb8db0b4d81cd366a56808f950c3d6f8719f658/pkg/readiness/ready_tracker.go#L353-L376)

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

```go
for _, ct := range templates.Items {
log.V(1).Info("expecting template", "name", ct.GetName())
t.templates.Expect(&ct)

gvk := schema.GroupVersionKind{
Group: constraintGroup,
Version: v1beta1.SchemeGroupVersion.Version,
Kind: ct.Spec.CRD.Spec.Names.Kind,
}
if _, ok := handled[gvk]; ok {
log.Info("duplicate constraint type", "gvk", gvk)
continue
}
handled[gvk] = true
// Set an expectation for this constraint type
ot := t.constraints.Get(gvk)
t.constraintTrackers.Go(gvk.String(), func(ctx context.Context) error {
err := t.trackConstraints(ctx, gvk, ot)
if err != nil {
log.Error(err, "aborted trackConstraints", "gvk", gvk)
}
return nil // do not return an error, this would abort other constraint trackers!
})
}

```

Click here to show extra information the analyzer produced.

```
No path was found through the callgraph that could lead to a function which writes a pointer argument.

No path was found through the callgraph that could lead to a function which passes a pointer to third-party code.

root signature {Expect 1} was not found in the callgraph; reference was passed directly to third-party code
```

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: 1fb8db0b4d81cd366a56808f950c3d6f8719f658

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.