github-vet / github-vet/rangeloop-pointer-findings
ypapax/kpi_dashboard: util.go; 25 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [ypapax/kpi_dashboard](https://www.github.com/ypapax/kpi_dashboard) at [util.go](https://github.com/ypapax/kpi_dashboard/blob/cb26be148b03e99920a30b3a49068730761140ca/util.go#L51-L75)
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 intf is reassigned at line 64
[Click here to see the code in its original context.](https://github.com/ypapax/kpi_dashboard/blob/cb26be148b03e99920a30b3a49068730761140ca/util.go#L51-L75)
Click here to show the 25 line(s) of Go which triggered the analyzer.
```go
for _, intf := range intfs {
cidrs, err := GetIPAddrs(intf.Name)
if err != nil {
return "", "", UNDEFINED, nil, fmt.Errorf("error looking interface - %v", err)
}
for _, cidr := range cidrs {
ip, _, err := net.ParseCIDR(cidr.String())
if err != nil {
continue
}
if ip.String() == h {
localAddr = h
localIntf = &intf
break OuterLoop
}
// Use 1st interface for bind = 0.0.0.0
// XXX Bad idea
if h == "0.0.0.0" {
localAddr = ip.String()
localIntf = &intf
break OuterLoop
}
}
}
```
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: cb26be148b03e99920a30b3a49068730761140ca
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.