github-vet / github-vet/rangeloop-pointer-findings
earthcubearchitecture-project418/gleaner: internal/millers/shapes/shaclng.go; 22 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [earthcubearchitecture-project418/gleaner](https://www.github.com/earthcubearchitecture-project418/gleaner) at [internal/millers/shapes/shaclng.go](https://github.com/earthcubearchitecture-project418/gleaner/blob/0745babba1be39a6bc1236758ffe953d9dc3314d/internal/millers/shapes/shaclng.go#L52-L73)
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 shape used in defer or goroutine at line 59
[Click here to see the code in its original context.](https://github.com/earthcubearchitecture-project418/gleaner/blob/0745babba1be39a6bc1236758ffe953d9dc3314d/internal/millers/shapes/shaclng.go#L52-L73)
Click here to show the 22 line(s) of Go which triggered the analyzer.
```go
for shape := range mc.ListObjectsV2(bucketname, "shapes", isRecursive, doneCh) {
// log.Printf("Checking data graphs against shape graph: %s\n", m[j])
for object := range mc.ListObjectsV2(bucketname, prefix, isRecursive, doneCh) {
wg.Add(1)
go func(object minio.ObjectInfo) {
semaphoreChan <- struct{}{}
//status := shaclTest(e[k].Urlval, e[k].Jld, m[j].Key, m[j].Jld, &gb)
_, err := shaclTestNG(v1, bucketname, "verified", mc, object, shape, proc, options)
if err != nil {
log.Println(err) // need to log to an "errors" log file
}
// _, err := obj2RDF(bucketname, prefix, mc, object, proc, options)
wg.Done() // tell the wait group that we be done
// log.Printf("Doc: %s error: %v ", name, err) // why print the status??
bar3.Incr()
<-semaphoreChan
}(object)
}
}
```
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: 0745babba1be39a6bc1236758ffe953d9dc3314d
Contributor guide
No contributing guide indexed for this repository
Research direction
Read internal/millers/shapes/shaclng.go at lines 52-73 and review the analyzer message about the range-loop variable used by the goroutine. Check how shape is passed into shaclTestNG and confirm the warning is addressed without changing the surrounding processing behavior. Done means the reported capture issue is resolved and the relevant project checks pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100