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

chaostesting/chaosgopher: app/src/app/data/balancer.go; 7 LoC

Open
#14,691 0 comments 0 reactions 0 assignees View on GitHub
fresh tiny
Dominant language
No language data
Stars
0
Forks
0
PR merge metrics
PR metrics pending

Description

Found a possible issue in [chaostesting/chaosgopher](https://www.github.com/chaostesting/chaosgopher) at [app/src/app/data/balancer.go](https://github.com/chaostesting/chaosgopher/blob/8c5262b6b7847f88a3de0a2390d05a72de66b521/app/src/app/data/balancer.go#L60-L66)

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 conn used in defer or goroutine at line 62

[Click here to see the code in its original context.](https://github.com/chaostesting/chaosgopher/blob/8c5262b6b7847f88a3de0a2390d05a72de66b521/app/src/app/data/balancer.go#L60-L66)

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

```go
for dsn, conn := range balancer.connections {
go func() {
if e := conn.Close(); e != nil {
balancer.Println("ignored Close() failure:", dsn)
}
}()
}

```

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: 8c5262b6b7847f88a3de0a2390d05a72de66b521

Contributor guide

No contributing guide indexed for this repository

Research direction

Open app/src/app/data/balancer.go at lines 60-66 and inspect how the range values are used by the goroutine. Check the surrounding balancer code and any available tests, then run the project's test suite; done means the analyzer finding is addressed without changing the intended close-error reporting.

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
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.