github-vet / github-vet/rangeloop-pointer-findings
psh686868/psh-mosn: pkg/upstream/healthcheck/healthchecker.go; 15 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [psh686868/psh-mosn](https://www.github.com/psh686868/psh-mosn) at [pkg/upstream/healthcheck/healthchecker.go](https://github.com/psh686868/psh-mosn/blob/76721eb06194665aa5318c667d8a36e6c188abe6/pkg/upstream/healthcheck/healthchecker.go#L102-L116)
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 host used in defer or goroutine at line 109
[Click here to see the code in its original context.](https://github.com/psh686868/psh-mosn/blob/76721eb06194665aa5318c667d8a36e6c188abe6/pkg/upstream/healthcheck/healthchecker.go#L102-L116)
Click here to show the 15 line(s) of Go which triggered the analyzer.
```go
for _, host := range hosts {
h := host
go func() {
var ns types.HealthCheckSession
if ns = c.newSession(h); ns == nil {
log.DefaultLogger.Errorf("Create Health Check Session Error, Remote Address = %s", host.AddressString())
return
}
c.healthCheckSessions[h] = ns
c.healthCheckSessions[h].Start()
}()
}
```
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: 76721eb06194665aa5318c667d8a36e6c188abe6
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.