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

materials-commons/mcstore: cmd/pkg/mc/downloader.go; 4 LoC

Open
#7,212 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 [materials-commons/mcstore](https://www.github.com/materials-commons/mcstore) at [cmd/pkg/mc/downloader.go](https://github.com/materials-commons/mcstore/blob/2be0f72f9fe984fd1ee5af59d6093608ac68b08b/cmd/pkg/mc/downloader.go#L162-L165)

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 entry at line 164 may start a goroutine

[Click here to see the code in its original context.](https://github.com/materials-commons/mcstore/blob/2be0f72f9fe984fd1ee5af59d6093608ac68b08b/cmd/pkg/mc/downloader.go#L162-L165)

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

```go
for _, entry := range dir.Children {
d.files = append(d.files, toFentry(&entry))
d.loadDirRecurse(projectID, &entry)
}

```

Click here to show extra information the analyzer produced.

```
The following paths through the callgraph could lead to a goroutine:
(loadDirRecurse, 2) -> (getProjectDirList, 2) -> (GetDirectoryList, 2) -> (HTTPStatusToError, 1) -> (Get, 1) -> (access, 5) -> (, 1) -> (int, 1) -> (runParallelGinkgoSuite, 0)
(loadDirRecurse, 2) -> (getProjectDirList, 2) -> (GetDirectoryList, 2) -> (HTTPStatusToError, 1) -> (Get, 1) -> (access, 5) -> (, 1) -> (int, 1) -> (sniffer, 0) -> (sniff, 1)
(loadDirRecurse, 2) -> (getProjectDirList, 2) -> (GetDirectoryList, 2) -> (HTTPStatusToError, 1) -> (decodeJSONResponse, 2) -> (Unmarshal, 2) -> (unmarshal, 2) -> (Itoa, 1) -> (SendRequest, 1) -> (Warning, 1)
(loadDirRecurse, 2) -> (getProjectDirList, 2) -> (GetDirectoryList, 2) -> (HTTPStatusToError, 1) -> (Get, 1) -> (access, 5) -> (, 1) -> (int, 1) -> (walkFiles, 2)
(loadDirRecurse, 2) -> (getProjectDirList, 2) -> (GetDirectoryList, 2) -> (HTTPStatusToError, 1) -> (Get, 1) -> (access, 5) -> (, 1) -> (int, 1) -> (processFile, 2)
(loadDirRecurse, 2) -> (getProjectDirList, 2) -> (GetDirectoryList, 2) -> (HTTPStatusToError, 1) -> (Get, 1) -> (access, 5) -> (, 1) -> (int, 1) -> (SendRequest, 1)
(loadDirRecurse, 2) -> (getProjectDirList, 2) -> (GetDirectoryList, 2) -> (HTTPStatusToError, 1) -> (Get, 1) -> (access, 5) -> (, 1) -> (int, 1) -> (RunSpecs, 2) -> (RunSpecsWithCustomReporters, 3) -> (NewOutputInterceptor, 0)
(loadDirRecurse, 2) -> (getProjectDirList, 2) -> (GetDirectoryList, 2) -> (HTTPStatusToError, 1) -> (Get, 1) -> (access, 5) -> (, 1) -> (int, 1) -> (Start, 3)
(loadDirRecurse, 2) -> (getProjectDirList, 2) -> (GetDirectoryList, 2) -> (HTTPStatusToError, 1) -> (decodeJSONResponse, 2) -> (Unmarshal, 2) -> (unmarshal, 2) -> (Itoa, 1) -> (SendRequest, 1)
(loadDirRecurse, 2) -> (getProjectDirList, 2) -> (GetDirectoryList, 2) -> (HTTPStatusToError, 1) -> (Get, 1) -> (access, 5) -> (, 1) -> (int, 1) -> (run, 0) -> (runSync, 0)
(loadDirRecurse, 2) -> (getProjectDirList, 2) -> (GetDirectoryList, 2) -> (HTTPStatusToError, 1) -> (Get, 1) -> (access, 5) -> (, 1) -> (int, 1) -> (SendRequest, 1) -> (Warning, 1)
(loadDirRecurse, 2) -> (getProjectDirList, 2) -> (GetDirectoryList, 2) -> (HTTPStatusToError, 1) -> (Get, 1) -> (access, 5) -> (, 1) -> (int, 1) -> (Start, 0) -> (infof, 1) -> (healthcheck, 2)
(loadDirRecurse, 2) -> (getProjectDirList, 2) -> (GetDirectoryList, 2) -> (HTTPStatusToError, 1) -> (Get, 1) -> (access, 5) -> (, 1) -> (int, 1)
(loadDirRecurse, 2) -> (getProjectDirList, 2) -> (GetDirectoryList, 2) -> (HTTPStatusToError, 1) -> (Get, 1) -> (access, 5) -> (, 1) -> (int, 1) -> (runAndStreamParallelGinkgoSuite, 0)
(loadDirRecurse, 2) -> (getProjectDirList, 2) -> (GetDirectoryList, 2) -> (HTTPStatusToError, 1) -> (Get, 1) -> (access, 5) -> (, 1) -> (int, 1) -> (registerForInterrupts, 0)
(loadDirRecurse, 2) -> (getProjectDirList, 2) -> (GetDirectoryList, 2) -> (HTTPStatusToError, 1) -> (Get, 1) -> (access, 5) -> (, 1) -> (int, 1) -> (Start, 0)
(loadDirRecurse, 2) -> (getProjectDirList, 2) -> (GetDirectoryList, 2) -> (HTTPStatusToError, 1) -> (Get, 1) -> (access, 5) -> (, 1) -> (int, 1) -> (NewTicker, 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: 2be0f72f9fe984fd1ee5af59d6093608ac68b08b

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.