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

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

Open
#13,405 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 [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#L539-L544)

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 ep2 at line 540 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#L539-L544)

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

```go
for _, ep2 := range e2.Endpoints {
if (&ep1).Equal(&ep2) {
found = true
break
}
}

```

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

Research direction

Open WorkShop_2.5_Kubernetes_RealWorld/ingress-nginx/internal/ingress/types_equals.go and inspect the Equal call around lines 539-544, along with the analyzer message and call graph. Decide whether the range-variable reference is a bug, mitigated, or desirable behavior, then record that classification with the corresponding reaction.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
networking
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.