github-vet / github-vet/rangeloop-pointer-findings
xlab/c-for-go: main.go; 39 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [xlab/c-for-go](https://www.github.com/xlab/c-for-go) at [main.go](https://github.com/xlab/c-for-go/blob/3ba5db515dcb74f806b876c92267df9ea7b18c10/main.go#L56-L94)
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 cfgPath used in defer or goroutine at line 64
[Click here to see the code in its original context.](https://github.com/xlab/c-for-go/blob/3ba5db515dcb74f806b876c92267df9ea7b18c10/main.go#L56-L94)
Click here to show the 39 line(s) of Go which triggered the analyzer.
```go
for _, cfgPath := range getConfigPaths() {
if *fancy {
wg.Add(1)
go func() {
for {
select {
case <-doneChan:
doneChan = make(chan struct{})
fmt.Printf("\r \033[36mprocessing %s\033[m done.\n", cfgPath)
wg.Done()
return
default:
fmt.Printf("\r \033[36mprocessing %s\033[m %s", cfgPath, s.Next())
time.Sleep(100 * time.Millisecond)
}
}
}()
}
var t0 time.Time
if *debug {
t0 = time.Now()
}
process, err := NewProcess(cfgPath, *outputPath)
if err != nil {
log.Fatalln("[ERR]", err)
}
process.Generate(*noCGO)
if err := process.Flush(*noCGO); err != nil {
log.Fatalln("[ERR]", err)
}
if *debug {
fmt.Printf("done in %v\n", time.Now().Sub(t0))
}
if *fancy {
close(doneChan)
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: 3ba5db515dcb74f806b876c92267df9ea7b18c10
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.