return errNoSuchHost

This commit is contained in:
Mateusz Poliwczak 2022-11-15 20:41:28 +01:00
parent 0266671e3d
commit ff756a73d8
1 changed files with 5 additions and 1 deletions

View File

@ -556,9 +556,13 @@ func (r *Resolver) goLookupHostOrder(ctx context.Context, name string, order hos
if order == hostLookupFilesDNS || order == hostLookupFiles {
// Use entries from /etc/hosts if they match.
addrs, _ = lookupStaticHost(name)
if len(addrs) > 0 || order == hostLookupFiles {
if len(addrs) > 0 {
return
}
if order == hostLookupFiles {
return nil, &DNSError{Err: errNoSuchHost.Error(), Name: name, IsNotFound: true}
}
}
ips, _, err := r.goLookupIPCNAMEOrder(ctx, "ip", name, order, conf)
if err != nil {