github-vet / github-vet/rangeloop-pointer-findings
maximus-next/repo.nefrosovet.ru: maximus-platform/recognition/services/AWS/rekognition.go; 46 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [maximus-next/repo.nefrosovet.ru](https://www.github.com/maximus-next/repo.nefrosovet.ru) at [maximus-platform/recognition/services/AWS/rekognition.go](https://github.com/maximus-next/repo.nefrosovet.ru/blob/80b356989a4eee6ab03284865832189c3dfa1bd5/maximus-platform/recognition/services/AWS/rekognition.go#L277-L322)
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 key used in defer or goroutine at line 314
[Click here to see the code in its original context.](https://github.com/maximus-next/repo.nefrosovet.ru/blob/80b356989a4eee6ab03284865832189c3dfa1bd5/maximus-platform/recognition/services/AWS/rekognition.go#L277-L322)
Click here to show the 46 line(s) of Go which triggered the analyzer.
```go
for _, key := range keys {
c.wg.Add(1)
go func(k string) {
defer c.wg.Done()
input := &rekognition.CompareFacesInput{
SimilarityThreshold: aws.Float64(c.similarity),
SourceImage: &rekognition.Image{
Bytes: sourceImage,
},
TargetImage: &rekognition.Image{
S3Object: &rekognition.S3Object{
Bucket: aws.String(c.bucket),
Name: aws.String(k),
},
},
}
var compareOut *rekognition.CompareFacesOutput
compareOut, err = c.recognition.CompareFaces(input)
if err != nil {
once.Do(func() {
rekErr = err // to be aware that at least one rekognition was failed and what error was
})
return
}
if len(compareOut.FaceMatches) == 0 {
return
}
var mf *rekognition.CompareFacesMatch
for _, mf = range compareOut.FaceMatches {
if mf.Similarity == nil {
continue
}
if *mf.Similarity >= c.similarity {
matchedChan <- FaceMatch{
Key: key,
Similarity: mf.Similarity,
}
return // for now we process only one person on a photo
}
}
}(key.String())
}
```
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: 80b356989a4eee6ab03284865832189c3dfa1bd5
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.