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

praparn/kubernetes_201904: WorkShop_2.5_Kubernetes_RealWorld/ingress-nginx/internal/ingress/types_equals.go; 12 LoC

Open
#13,404 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 [praparn/kubernetes_201904](https://www.github.com/praparn/kubernetes_201904) at [WorkShop_2.5_Kubernetes_RealWorld/ingress-nginx/internal/ingress/types_equals.go](https://github.com/praparn/kubernetes_201904/blob/92c6c826b9a75a27925c13dcf921100d54c3e015/WorkShop_2.5_Kubernetes_RealWorld/ingress-nginx/internal/ingress/types_equals.go#L59-L70)

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 tcp1 at line 62 may start a goroutine

[Click here to see the code in its original context.](https://github.com/praparn/kubernetes_201904/blob/92c6c826b9a75a27925c13dcf921100d54c3e015/WorkShop_2.5_Kubernetes_RealWorld/ingress-nginx/internal/ingress/types_equals.go#L59-L70)

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

```go
for _, tcp1 := range c1.TCPEndpoints {
found := false
for _, tcp2 := range c2.TCPEndpoints {
if (&tcp1).Equal(&tcp2) {
found = true
break
}
}
if !found {
return false
}
}

```

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 {
"(Start, 1)" -> {}
"(RoundTrip, 1)" -> {"(awaitOpenSlotForRequest, 1)";}
"(tryUpgrade, 2)" -> {}
"(Equal, 1)" -> {"(Compare, 1)";}
"(Set, 1)" -> {"(New, 1)";"(Add, 2)";"(New, 2)";"(Parse, 1)";}
"(addConnIfNeeded, 3)" -> {}
"(serverHandshake, 1)" -> {"(newServerTransport, 4)";}
"(newClient, 1)" -> {"(dial, 2)";"(NewLease, 1)";}
"(New, 1)" -> {"(get, 1)";"(newClient, 1)";"(Start, 1)";"(New, 2)";"(apply, 2)";"(Parse, 1)";"(Merge, 1)";}
"(Parse, 1)" -> {"(Set, 2)";}
"(apply, 2)" -> {"(applyRequest, 1)";}
"(Merge, 1)" -> {"(Set, 2)";}
"(newServerTransport, 4)" -> {}
"(parse, 1)" -> {"(append, 1)";"(New, 1)";"(Parse, 1)";"(Push, 1)";"(copy, 2)";}
"(parseTag, 1)" -> {"(copy, 2)";}
"(get, 1)" -> {"(SetTransportDefaults, 1)";"(Get, 1)";}
"(New, 2)" -> {"(Start, 1)";}
"(Copy, 2)" -> {"(ServeHTTP, 2)";}
"(awaitOpenSlotForRequest, 1)" -> {}
"(ConfigureTransport, 1)" -> {"(configureTransport, 1)";}
"(parseExtension, 1)" -> {"(copy, 2)";}
"(clientHandshake, 2)" -> {"(newClientTransport, 6)";}
"(newClientTransport, 6)" -> {}
"(Push, 1)" -> {"(Set, 2)";}
"(dial, 2)" -> {"(NewServerConn, 2)";"(NewClientConn, 3)";}
"(Do, 3)" -> {}
"(Add, 2)" -> {"(Do, 2)";}
"(append, 1)" -> {}
"(Set, 2)" -> {"(Do, 3)";}
"(ServeHTTP, 2)" -> {"(tryUpgrade, 2)";"(tryUpgrade, 7)";}
"(Get, 1)" -> {"(Get, 2)";}
"(NewServerConn, 2)" -> {"(serverHandshake, 1)";}
"(parse, 2)" -> {"(parse, 1)";"(Set, 1)";"(parseTag, 1)";"(parseExtensions, 1)";}
"(Do, 2)" -> {"(RoundTrip, 1)";}
"(NewLease, 1)" -> {}
"(applyRequest, 1)" -> {"(Copy, 2)";}
"(copy, 2)" -> {"(get, 1)";"(findObject, 2)";}
"(SetTransportDefaults, 1)" -> {"(ConfigureTransport, 1)";}
"(configureTransport, 1)" -> {"(addConnIfNeeded, 3)";}
"(parseExtensions, 1)" -> {"(parseExtension, 1)";}
"(Compare, 1)" -> {"(parse, 2)";}
"(Get, 2)" -> {"(handle, 2)";}
"(handle, 2)" -> {"(ServeHTTP, 2)";}
"(NewClientConn, 3)" -> {"(clientHandshake, 2)";}
"(tryUpgrade, 7)" -> {}
"(findObject, 2)" -> {"(get, 1)";}
}

```

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: 92c6c826b9a75a27925c13dcf921100d54c3e015

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.