github-vet / github-vet/rangeloop-pointer-findings
swx457056/test-ci-bot: pkg/edged/util/util.go; 35 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [swx457056/test-ci-bot](https://www.github.com/swx457056/test-ci-bot) at [pkg/edged/util/util.go](https://github.com/swx457056/test-ci-bot/blob/2bd4399b5897cc900687ebad602db90aa076cf0c/pkg/edged/util/util.go#L261-L295)
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.
> function call which takes a reference to intf at line 262 may start a goroutine
[Click here to see the code in its original context.](https://github.com/swx457056/test-ci-bot/blob/2bd4399b5897cc900687ebad602db90aa076cf0c/pkg/edged/util/util.go#L261-L295)
Click here to show the 35 line(s) of Go which triggered the analyzer.
```go
for _, intf := range intfs {
if !IsInterfaceUp(&intf) {
log.LOGGER.Infof("Skipping: down interface %q", intf.Name)
continue
}
if IsLoopbackOrPointToPoint(&intf) {
log.LOGGER.Infof("Skipping: LB or P2P interface %q", intf.Name)
continue
}
addrs, err := nw.Addrs(&intf)
if err != nil {
return nil, err
}
if len(addrs) == 0 {
log.LOGGER.Infof("Skipping: no addresses on interface %q", intf.Name)
continue
}
for _, addr := range addrs {
ip, _, err := net.ParseCIDR(addr.String())
if err != nil {
return nil, fmt.Errorf("Unable to parse CIDR for interface %q: %s", intf.Name, err)
}
if !MemberOf(ip, family) {
log.LOGGER.Infof("Skipping: no address family match for %q on interface %q.", ip, intf.Name)
continue
}
// TODO: Decide if should open up to allow IPv6 LLAs in future.
if !ip.IsGlobalUnicast() {
log.LOGGER.Infof("Skipping: non-global address %q on interface %q.", ip, intf.Name)
continue
}
log.LOGGER.Infof("Found global unicast address %q on interface %q.", ip, intf.Name)
return ip, nil
}
}
```
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: 2bd4399b5897cc900687ebad602db90aa076cf0c
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.