github-vet / github-vet/rangeloop-pointer-findings
nbedos/cistern: providers/cache.go; 32 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [nbedos/cistern](https://www.github.com/nbedos/cistern) at [providers/cache.go](https://github.com/nbedos/cistern/blob/ba29e81999bdc4873696b202c205d62c0309c243/providers/cache.go#L791-L822)
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.
> range-loop variable commit used in defer or goroutine at line 810
[Click here to see the code in its original context.](https://github.com/nbedos/cistern/blob/ba29e81999bdc4873696b202c205d62c0309c243/providers/cache.go#L791-L822)
Click here to show the 32 line(s) of Go which triggered the analyzer.
```go
for commit := range commitc {
c.SaveCommit(ref.Name, commit)
if updates != nil {
wg.Add(1)
go func() {
defer wg.Done()
select {
case updates <- PipelineChanges{}:
// Do nothing
case <-ctx.Done():
// Do nothing
}
}()
}
for _, u := range commit.Statuses {
if _, exists := urls[u]; !exists {
wg.Add(1)
go func(u string) {
defer wg.Done()
err := c.broadcastMonitorPipeline(ctx, commit.Sha, u, updates)
// Ignore ErrUnknownPipelineURL. This error means that we don't integrate
// with the application that created that particular url. No need to report
// this up the chain, though it's nice to know our request couldn't be handled.
if err != ErrUnknownPipelineURL {
errc <- err
return
}
}(u)
urls[u] = struct{}{}
}
}
}
```
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: ba29e81999bdc4873696b202c205d62c0309c243
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.