github-vet / github-vet/rangeloop-pointer-findings
vicanso/pike: server/admin.go; 21 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [vicanso/pike](https://www.github.com/vicanso/pike) at [server/admin.go](https://github.com/vicanso/pike/blob/2c7ddcf22c97c0d355ae1462f2142172aebfe797/server/admin.go#L177-L197)
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.
> reference to item is reassigned at line 183
[Click here to see the code in its original context.](https://github.com/vicanso/pike/blob/2c7ddcf22c97c0d355ae1462f2142172aebfe797/server/admin.go#L177-L197)
Click here to show the 21 line(s) of Go which triggered the analyzer.
```go
for i, item := range conf.Upstreams {
up := upstream.Get(item.Name)
if len(item.Servers) == 0 || up == nil {
upstreamServers[i] = item
continue
}
p := &item
statusList := up.GetServerStatusList()
servers := make([]config.UpstreamServerConfig, len(p.Servers))
// 填充upstream server的状态
for j, server := range p.Servers {
for _, status := range statusList {
if server.Addr == status.Addr {
server.Healthy = status.Healthy
}
}
servers[j] = server
}
p.Servers = servers
upstreamServers[i] = *p
}
```
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: 2c7ddcf22c97c0d355ae1462f2142172aebfe797
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.