github-vet / github-vet/rangeloop-pointer-findings
MangoDowner/go-gm: src/net/dnsclient_unix.go; 37 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [MangoDowner/go-gm](https://www.github.com/MangoDowner/go-gm) at [src/net/dnsclient_unix.go](https://github.com/MangoDowner/go-gm/blob/8baa2bd4408c3a997288c651e74f8417e1b1500c/src/net/dnsclient_unix.go#L480-L516)
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 fqdn used in defer or goroutine at line 483
[Click here to see the code in its original context.](https://github.com/MangoDowner/go-gm/blob/8baa2bd4408c3a997288c651e74f8417e1b1500c/src/net/dnsclient_unix.go#L480-L516)
Click here to show the 37 line(s) of Go which triggered the analyzer.
```go
for _, fqdn := range conf.nameList(name) {
for _, qtype := range qtypes {
go func(qtype uint16) {
cname, rrs, err := r.tryOneName(ctx, conf, fqdn, qtype)
lane <- racer{cname, rrs, err}
}(qtype)
}
hitStrictError := false
for range qtypes {
racer := <-lane
if racer.error != nil {
if nerr, ok := racer.error.(Error); ok && nerr.Temporary() && r.StrictErrors {
// This error will abort the nameList loop.
hitStrictError = true
lastErr = racer.error
} else if lastErr == nil || fqdn == name+"." {
// Prefer error for original name.
lastErr = racer.error
}
continue
}
addrs = append(addrs, addrRecordList(racer.rrs)...)
if cname == "" {
cname = racer.cname
}
}
if hitStrictError {
// If either family hit an error with StrictErrors enabled,
// discard all addresses. This ensures that network flakiness
// cannot turn a dualstack hostname IPv4/IPv6-only.
addrs = nil
break
}
if len(addrs) > 0 {
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: 8baa2bd4408c3a997288c651e74f8417e1b1500c
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.