github-vet / github-vet/rangeloop-pointer-findings
johnprather/xen-cli: xen-daemon/xen_data.go; 20 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [johnprather/xen-cli](https://www.github.com/johnprather/xen-cli) at [xen-daemon/xen_data.go](https://github.com/johnprather/xen-cli/blob/b45751c59d8b63ede4011b17b62fcad0fd4b9e9c/xen-daemon/xen_data.go#L63-L82)
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 svr used in defer or goroutine at line 70
[Click here to see the code in its original context.](https://github.com/johnprather/xen-cli/blob/b45751c59d8b63ede4011b17b62fcad0fd4b9e9c/xen-daemon/xen_data.go#L63-L82)
Click here to show the 20 line(s) of Go which triggered the analyzer.
```go
for key, svr := range x.servers {
if svr.Hostname == hostname || svr.Hostname == hostname+"." {
x.servers = append(x.servers[0:key], x.servers[key+1:]...)
if _, ok := x.pollers[svr]; ok {
// it may take the poller time to notice doneCh, don't wait
// (we have a lock for x.servers, gotta be quick)
go func() {
x.pollers[svr].doneCh <- true
delete(x.pollers, svr)
}()
}
err := secure.DelPassword(svr.IP.String())
if err != nil {
log.Println("DelPassword():", err)
}
deleted = true
deletedHostname = svr.Hostname
break
}
}
```
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: b45751c59d8b63ede4011b17b62fcad0fd4b9e9c
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.