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

gpte-integr8ly/rhpam-dev-operator: pkg/controller/rhpamdev/phaseHandler.go; 7 LoC

Open
#11,188 0 comments 0 reactions 0 assignees View on GitHub
fresh tiny
Dominant language
No language data
Stars
0
Forks
0
PR merge metrics
PR metrics pending

Description

Found a possible issue in [gpte-integr8ly/rhpam-dev-operator](https://www.github.com/gpte-integr8ly/rhpam-dev-operator) at [pkg/controller/rhpamdev/phaseHandler.go](https://github.com/gpte-integr8ly/rhpam-dev-operator/blob/104d35d579000e38a0bd63acb1fed766b3c6c306/pkg/controller/rhpamdev/phaseHandler.go#L277-L283)

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.

> function call which takes a reference to rhpamuser at line 281 may start a goroutine

[Click here to see the code in its original context.](https://github.com/gpte-integr8ly/rhpam-dev-operator/blob/104d35d579000e38a0bd63acb1fed766b3c6c306/pkg/controller/rhpamdev/phaseHandler.go#L277-L283)

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

```go
for _, rhpamuser := range rhpamuserlist.Items {
log.Info("Rhpamuser found", "Name", rhpamuser.Name, "Status", rhpamuser.Status.Phase)
if rhpam.Status.Realm == rhpamuser.Status.Realm {
rhpamuser.Status.Phase = rhpamv1alpha1.PhaseDeprovisioned
ph.client.Update(context.TODO(), &rhpamuser)
}
}

```

Click here to show extra information the analyzer produced.

```
The following graphviz dot graph describes paths through the callgraph that could lead to a function calling a goroutine:
digraph G {
"(Decode, 1)" -> {"(Add, 2)";"(Count, 2)";}
"(Count, 2)" -> {"(Run, 2)";}
"(Update, 3)" -> {"(Set, 2)";}
"(Encode, 2)" -> {"(Write, 1)";}
"(Read, 2)" -> {"(read, 2)";}
"(read, 2)" -> {"(Get, 3)";}
"(DialURL, 3)" -> {"(Dial, 3)";}
"(set, 4)" -> {"(Do, 2)";}
"(ConnectWithRedirects, 6)" -> {"(Dial, 1)";}
"(Set, 2)" -> {"(set, 4)";}
"(run, 3)" -> {}
"(Add, 1)" -> {"(Add, 2)";}
"(handle, 2)" -> {}
"(implements, 1)" -> {"(Build, 1)";}
"(globalReferrersPkgLevel, 3)" -> {}
"(awaitOpenSlotForRequest, 1)" -> {}
"(get, 1)" -> {"(Get, 1)";"(SetTransportDefaults, 1)";}
"(Dial, 3)" -> {"(NewClientConn, 3)";}
"(NewClientConn, 3)" -> {"(clientHandshake, 2)";}
"(dialWithoutProxy, 2)" -> {"(Dial, 3)";}
"(Add, 2)" -> {"(set, 4)";}
"(Build, 1)" -> {"(ForEachPackage, 2)";}
"(Get, 3)" -> {"(Get, 2)";"(RoundTrip, 1)";}
"(Update, 2)" -> {"(Add, 1)";"(Encode, 2)";"(Decode, 2)";"(New, 1)";"(Format, 1)";"(Decode, 1)";"(Update, 3)";}
"(tryUpgrade, 2)" -> {}
"(ForEachPackage, 2)" -> {"(allPackages, 3)";}
"(configureTransport, 1)" -> {"(addConnIfNeeded, 3)";}
"(f, 2)" -> {}
"(Format, 1)" -> {"(Set, 2)";}
"(ConfigureTransport, 1)" -> {"(configureTransport, 1)";}
"(referrers, 1)" -> {"(globalReferrersPkgLevel, 3)";}
"(InjectOwnerReferenceHandler, 2)" -> {"(ServeHTTP, 2)";}
"(RoundTrip, 1)" -> {"(Dial, 1)";"(ConnectWithRedirects, 6)";"(roundTrip, 1)";"(RoundTripOpt, 2)";}
"(Decode, 2)" -> {"(f, 2)";"(Decode, 1)";}
"(Get, 1)" -> {"(Do, 2)";"(Get, 2)";}
"(Do, 2)" -> {}
"(SetTransportDefaults, 1)" -> {"(ConfigureTransport, 1)";}
"(roundTrip, 1)" -> {"(awaitOpenSlotForRequest, 1)";}
"(dial, 1)" -> {"(dialWithoutProxy, 2)";}
"(clientHandshake, 2)" -> {"(newClientTransport, 6)";}
"(newClientTransport, 6)" -> {}
"(New, 1)" -> {"(get, 1)";"(Read, 2)";}
"(dial, 2)" -> {"(DialURL, 3)";}
"(addConnIfNeeded, 3)" -> {}
"(RoundTripOpt, 2)" -> {"(roundTrip, 1)";}
"(Get, 2)" -> {"(Do, 2)";"(handle, 2)";}
"(Write, 1)" -> {"(Count, 2)";}
"(ServeHTTP, 2)" -> {"(tryUpgrade, 2)";}
"(allPackages, 3)" -> {}
"(Dial, 1)" -> {"(dial, 1)";"(dial, 2)";}
"(Run, 2)" -> {"(run, 3)";"(implements, 1)";"(referrers, 1)";"(InjectOwnerReferenceHandler, 2)";}
}

```

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: 104d35d579000e38a0bd63acb1fed766b3c6c306

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.