github-vet / github-vet/rangeloop-pointer-findings
nmiculinic/wg-quick-go: wg.go; 19 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [nmiculinic/wg-quick-go](https://www.github.com/nmiculinic/wg-quick-go) at [wg.go](https://github.com/nmiculinic/wg-quick-go/blob/551e747c00593755fce3371cbe4c4779b644208d/wg.go#L220-L238)
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 addr was used in a composite literal at line 229
[Click here to see the code in its original context.](https://github.com/nmiculinic/wg-quick-go/blob/551e747c00593755fce3371cbe4c4779b644208d/wg.go#L220-L238)
Click here to show the 19 line(s) of Go which triggered the analyzer.
```go
for _, addr := range cfg.Address {
log := log.WithField("addr", addr.String())
_, present := presentAddresses[addr.String()]
presentAddresses[addr.String()] = netlink.Addr{} // mark as present
if present {
log.Info("address present")
continue
}
if err := netlink.AddrAdd(link, &netlink.Addr{
IPNet: &addr,
Label: cfg.AddressLabel,
}); err != nil {
if err != syscall.EEXIST {
log.WithError(err).Error("cannot add addr")
return err
}
}
log.Info("address added")
}
```
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: 551e747c00593755fce3371cbe4c4779b644208d
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.