github-vet / github-vet/rangeloop-pointer-findings
qlik-oss/corectl: internal/measure.go; 38 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [qlik-oss/corectl](https://www.github.com/qlik-oss/corectl) at [internal/measure.go](https://github.com/qlik-oss/corectl/blob/042ed2a4db3f0449130ba2cd10a1fe20e8f27fd5/internal/measure.go#L78-L115)
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 path used in defer or goroutine at line 90
[Click here to see the code in its original context.](https://github.com/qlik-oss/corectl/blob/042ed2a4db3f0449130ba2cd10a1fe20e8f27fd5/internal/measure.go#L78-L115)
Click here to show the 38 line(s) of Go which triggered the analyzer.
```go
for _, path := range paths {
rawEntities, err := parseEntityFile(path)
if err != nil {
log.Fatalf("could not parse file %s: %s\n", path, err)
}
ch := make(chan error)
for _, raw := range rawEntities {
go func(raw json.RawMessage) {
var measure Measure
err := json.Unmarshal(raw, &measure)
if err != nil {
ch <- fmt.Errorf("could not parse data in file %s: %s", path, err)
return
}
err = measure.validate()
if err != nil {
ch <- fmt.Errorf("validation error in file %s: %s", path, err)
return
}
ch <- setMeasure(ctx, doc, measure.Info.Id, raw)
}(raw)
}
// Loop through the responses and see if there are any failures, if so exit with a fatal
success := true
for range rawEntities {
err := <-ch
if err != nil {
log.Errorln(err)
success = false
}
}
if !success {
log.Fatalln("One or more measures failed to be created or updated")
}
}
```
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: 042ed2a4db3f0449130ba2cd10a1fe20e8f27fd5
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.