github-vet / github-vet/rangeloop-pointer-findings

bootic/bootic_events_persistence: backend/buffered_client.go; 13 LoC

Open
#15,494 0 comments 0 reactions 0 assignees View on GitHub
fresh small
Dominant language
No language data
Stars
0
Forks
0
PR merge metrics
PR metrics pending

Description

Found a possible issue in [bootic/bootic_events_persistence](https://www.github.com/bootic/bootic_events_persistence) at [backend/buffered_client.go](https://github.com/bootic/bootic_events_persistence/blob/186bf72e49d768345455a160ed54833cb9b2e94a/backend/buffered_client.go#L28-L40)

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 33

[Click here to see the code in its original context.](https://github.com/bootic/bootic_events_persistence/blob/186bf72e49d768345455a160ed54833cb9b2e94a/backend/buffered_client.go#L28-L40)

Click here to show the 13 line(s) of Go which triggered the analyzer.

```go
for i := range cl.clients {

go func() {
defer func() {
if err := recover(); err != nil {
log.Println("Goroutine failed:", cl.clients[i], err)
}
}()

cl.clients[i].Submit()
}()

}

```

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: 186bf72e49d768345455a160ed54833cb9b2e94a

Contributor guide

No contributing guide indexed for this repository

Research direction

Open backend/buffered_client.go at lines 28-40 and inspect the range loop, deferred recovery, and goroutine calls. Confirm whether the reported range-loop capture is a bug, mitigated, or desirable behavior; the issue is complete when one of those classifications is supported by the code’s behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.