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

weliang1/upstream: pkg/cmd/cli/describe/describer.go; 11 LoC

Open
#8,987 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 [weliang1/upstream](https://www.github.com/weliang1/upstream) at [pkg/cmd/cli/describe/describer.go](https://github.com/weliang1/upstream/blob/1532bfcc115ccbd74a084568bbc55d131f6e9bf2/pkg/cmd/cli/describe/describer.go#L444-L454)

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 build at line 448 may start a goroutine

[Click here to see the code in its original context.](https://github.com/weliang1/upstream/blob/1532bfcc115ccbd74a084568bbc55d131f6e9bf2/pkg/cmd/cli/describe/describer.go#L444-L454)

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

```go
for i, build := range builds {
fmt.Fprintf(out, "%s \t%s \t%v \t%v\n",
build.Name,
strings.ToLower(string(build.Status.Phase)),
describeBuildDuration(&build),
build.CreationTimestamp.Rfc3339Copy().Time)
// only print the 10 most recent builds.
if i == 9 {
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 {
"(Watch, 2)" -> {}
"(connectAndResolve, 2)" -> {"(dnsQueryWithTimeout, 3)";}
"(startNode, 3)" -> {"(StartNode, 2)";}
"(restartNode, 2)" -> {"(RestartNode, 1)";}
"(get, 1)" -> {"(Copy, 2)";"(Get, 1)";"(Write, 1)";}
"(Build, 0)" -> {"(Run, 1)";"(Build, 1)";}
"(Get, 2)" -> {"(Open, 2)";"(Stat, 2)";"(Get, 3)";"(getURL, 1)";}
"(start, 1)" -> {}
"(get, 2)" -> {"(Stat, 2)";"(Get, 2)";"(Get, 3)";}
"(Stat, 2)" -> {"(Do, 3)";}
"(resolveSearch, 2)" -> {"(dnsQueryWithTimeout, 3)";}
"(getURL, 1)" -> {"(RoundTrip, 1)";}
"(getExtensionResources, 1)" -> {"(Get, 2)";}
"(Read, 1)" -> {"(Copy, 2)";}
"(RunKubelet, 1)" -> {"(startKubelet, 3)";}
"(getConn, 1)" -> {"(dial, 2)";}
"(Dial, 3)" -> {"(NewClientConn, 3)";}
"(serveHTTP, 2)" -> {"(post, 1)";}
"(Has, 1)" -> {"(Get, 1)";}
"(List, 4)" -> {"(query, 2)";}
"(Init, 1)" -> {"(NewConn, 1)";}
"(Server, 2)" -> {"(NewServer, 1)";}
"(DialURL, 2)" -> {"(Dial, 3)";}
"(describeBuildDuration, 1)" -> {"(Sub, 1)";}
"(List, 1)" -> {"(List, 2)";}
"(Capture, 2)" -> {"(Init, 1)";}
"(Do, 3)" -> {}
"(Save, 1)" -> {}
"(dialWithoutProxy, 1)" -> {"(Dial, 3)";}
"(newClientTransport, 6)" -> {}
"(Write, 1)" -> {"(Get, 1)";"(Capture, 2)";"(Copy, 2)";"(Do, 1)";}
"(Run, 1)" -> {"(Check, 0)";"(Start, 1)";"(StartControllers, 4)";"(NewSSHTunnelList, 4)";"(NewConfigFactory, 2)";}
"(New, 3)" -> {"(List, 1)";}
"(Handler, 1)" -> {"(ServeHTTP, 2)";}
"(Exists, 1)" -> {"(run, 2)";"(Stat, 2)";}
"(watchServices, 1)" -> {}
"(clientHandshake, 2)" -> {"(newClientTransport, 6)";}
"(New, 1)" -> {"(New, 3)";"(init, 1)";"(get, 1)";"(Parse, 1)";"(List, 4)";"(Decode, 2)";"(New, 2)";"(NewClient, 2)";"(InstallAPIs, 1)";}
"(InstallAPIs, 1)" -> {"(getExtensionResources, 1)";"(initV1ResourcesStorage, 1)";"(Run, 1)";}
"(tryUpgrade, 6)" -> {"(DialURL, 2)";}
"(Run, 2)" -> {"(watchServices, 1)";}
"(startKubelet, 3)" -> {}
"(RoundTrip, 1)" -> {"(DetailedRoundTrip, 1)";"(dial, 1)";}
"(NewServerConn, 2)" -> {"(serverHandshake, 1)";}
"(Add, 1)" -> {"(Parse, 1)";"(New, 1)";"(AppendChild, 1)";"(Has, 1)";}
"(init, 1)" -> {"(Handler, 1)";}
"(AddPod, 1)" -> {}
"(dnsQueryWithTimeout, 3)" -> {}
"(NewServer, 1)" -> {"(restartNode, 2)";"(restartAsStandaloneNode, 2)";"(serveHTTP, 2)";"(startNode, 3)";}
"(dialBackend, 1)" -> {"(Dial, 3)";}
"(Parse, 1)" -> {"(Build, 0)";}
"(WaitForRunningBuild, 4)" -> {"(Watch, 2)";}
"(NewClientConn, 3)" -> {"(clientHandshake, 2)";}
"(NewClient, 2)" -> {"(Run, 1)";"(Do, 1)";}
"(Build, 1)" -> {"(Save, 1)";"(Execute, 3)";}
"(Start, 1)" -> {"(start, 1)";}
"(NewSSHTunnelList, 4)" -> {}
"(ServeHTTP, 2)" -> {"(tryUpgrade, 6)";"(tryUpgrade, 2)";"(handle, 1)";"(serveUpgrade, 2)";"(RoundTrip, 1)";"(handleHttps, 2)";}
"(Open, 2)" -> {}
"(Execute, 3)" -> {}
"(Copy, 2)" -> {"(ServeHTTP, 2)";}
"(post, 1)" -> {}
"(Check, 0)" -> {"(connectAndResolve, 2)";"(resolveSearch, 2)";}
"(restartAsStandaloneNode, 2)" -> {"(RestartNode, 1)";}
"(dial, 1)" -> {"(dialWithoutProxy, 1)";}
"(query, 2)" -> {"(run, 2)";}
"(run, 2)" -> {"(RunKubelet, 1)";}
"(NewConfigFactory, 2)" -> {"(AddPod, 1)";}
"(initV1ResourcesStorage, 1)" -> {"(Get, 2)";}
"(New, 2)" -> {}
"(handle, 1)" -> {}
"(DetailedRoundTrip, 1)" -> {"(getConn, 1)";}
"(RestartNode, 1)" -> {}
"(serverHandshake, 1)" -> {"(newServerTransport, 4)";}
"(newServerTransport, 4)" -> {}
"(Do, 1)" -> {"(ServeHTTP, 2)";}
"(handleHttps, 2)" -> {"(Server, 2)";}
"(serveUpgrade, 2)" -> {"(dialBackend, 1)";}
"(dial, 2)" -> {"(NewServerConn, 2)";"(NewClientConn, 3)";}
"(StartNode, 2)" -> {}
"(Get, 3)" -> {"(Do, 3)";"(WaitForRunningBuild, 4)";}
"(AppendChild, 1)" -> {"(Write, 1)";}
"(Get, 1)" -> {"(Get, 2)";"(Exists, 1)";"(Get, 3)";"(get, 2)";"(getURL, 1)";"(List, 2)";}
"(List, 2)" -> {}
"(StartControllers, 4)" -> {"(Run, 2)";}
"(Decode, 2)" -> {"(Read, 1)";}
"(tryUpgrade, 2)" -> {"(DialURL, 2)";}
"(NewConn, 1)" -> {}
"(Sub, 1)" -> {"(Add, 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: 1532bfcc115ccbd74a084568bbc55d131f6e9bf2

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.