github-vet / github-vet/rangeloop-pointer-findings
ronaksoft/river-sdk: internal/uiexec/uiexec.go; 27 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [ronaksoft/river-sdk](https://www.github.com/ronaksoft/river-sdk) at [internal/uiexec/uiexec.go](https://github.com/ronaksoft/river-sdk/blob/4196eed596ce0c2a692e2198355de00668601778/internal/uiexec/uiexec.go#L30-L56)
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 it used in defer or goroutine at line 35
[Click here to see the code in its original context.](https://github.com/ronaksoft/river-sdk/blob/4196eed596ce0c2a692e2198355de00668601778/internal/uiexec/uiexec.go#L30-L56)
Click here to show the 27 line(s) of Go which triggered the analyzer.
```go
for it := range funcChan {
startTime := time.Now()
ctx, cf := context.WithTimeout(context.Background(), time.Second)
doneChan := make(chan struct{})
go func() {
it.fn()
doneChan <- struct{}{}
}()
select {
case <-doneChan:
case <-ctx.Done():
logs.Error("We timeout waiting for UI-Exec to return",
zap.String("C", msg.ConstructorNames[it.constructor]),
zap.String("Kind", it.kind),
)
}
cf() // Cancel func
endTime := time.Now()
if d := endTime.Sub(it.insertTime); d > maxDelay {
logs.Error("Too Long UIExec",
zap.String("C", msg.ConstructorNames[it.constructor]),
zap.String("Kind", it.kind),
zap.Duration("ExecT", endTime.Sub(startTime)),
zap.Duration("WaitT", endTime.Sub(it.insertTime)),
)
}
}
```
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: 4196eed596ce0c2a692e2198355de00668601778
Contributor guide
No contributing guide indexed for this repository
Research direction
Read internal/uiexec/uiexec.go around lines 30-56 and inspect the range loop, goroutine, and uses of it. Determine whether the analyzer warning represents a real behavior problem or is mitigated in this context; the issue is done when that classification is supported by the code.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100