github-vet / github-vet/rangeloop-pointer-findings
warpdotdev/warp-cli-survey: survey/survey.go; 31 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [warpdotdev/warp-cli-survey](https://www.github.com/warpdotdev/warp-cli-survey) at [survey/survey.go](https://github.com/warpdotdev/warp-cli-survey/blob/f371810d1b3cf50ff186c536ccec5b3a6322ed2b/survey/survey.go#L51-L81)
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 60
[Click here to see the code in its original context.](https://github.com/warpdotdev/warp-cli-survey/blob/f371810d1b3cf50ff186c536ccec5b3a6322ed2b/survey/survey.go#L51-L81)
Click here to show the 31 line(s) of Go which triggered the analyzer.
```go
for i, q := range questions {
if q.ShouldShowFn == nil || q.ShouldShowFn(responsesByQuestionID) {
response := getValidAnswer(reader, q, responsesByQuestionID, historyFilePath)
if response != nil {
responsesByQuestionID[q.ID] = response
if !response.Skipped {
// Execute in go routine so we can show progress
ch := make(chan int)
go func() {
storage.Write(response.Response(respondentID, i))
ch <- 1
}()
bar := progressbar.NewOptions(-1, progressbar.OptionSpinnerType(70))
ProgressLoop:
for {
select {
case <-ch:
bar.Clear()
break ProgressLoop
default:
bar.Add(1)
time.Sleep(40 * time.Millisecond)
}
}
}
}
fmt.Println()
}
}
```
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: f371810d1b3cf50ff186c536ccec5b3a6322ed2b
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.