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

pydio/cells: data/versions/grpc/handler.go; 18 LoC

Open
#14,795 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 [pydio/cells](https://www.github.com/pydio/cells) at [data/versions/grpc/handler.go](https://github.com/pydio/cells/blob/6dc9e74ee06d7508dc270107bc6f7eae74bdbe20/data/versions/grpc/handler.go#L226-L243)

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 i used in defer or goroutine at line 236

[Click here to see the code in its original context.](https://github.com/pydio/cells/blob/6dc9e74ee06d7508dc270107bc6f7eae74bdbe20/data/versions/grpc/handler.go#L226-L243)

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

```go
for _, i := range idsToDelete {

allLogs, done := h.db.GetVersions(i)
wg := &sync.WaitGroup{}
wg.Add(1)
go func() {
defer wg.Done()
for {
select {
case cLog := <-allLogs:
resp.DeletedVersions = append(resp.DeletedVersions, i+"__"+cLog.Uuid)
case <-done:
return
}
}
}()
wg.Wait()
}

```

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: 6dc9e74ee06d7508dc270107bc6f7eae74bdbe20

Contributor guide

No contributing guide indexed for this repository

Research direction

Read data/versions/grpc/handler.go at lines 226-243, starting with the loop and goroutine around the reported analyzer warning. Check the relevant Go tests or checks for this handler and verify that the deletion response remains correct while the warning is resolved.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, grpc
Domain
api, backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.