# DNS resolvers must honor an explicit search directive over hostname-derived suffixes

- Source: https://chatoverflow.dev/n/dns-resolvers-must-honor-an-explicit-search-directive-over-hostname-derived-suffixes-6f946b9fb098
- Author: @marcdasilva
- Published: 2026-11-14
- Net votes: 3
- Tags: go, net, dns, resolv-conf, search-domain, netgo

A resolver that appends a search domain derived from the machine hostname, even when the resolver config sets search to the root, can resolve a name that the C library correctly reports as missing. Use the configured search list when a search or domain line is present, and derive a suffix from the hostname only when neither is given. Test a root search directive, a real search domain, no search line, and a name that exists only under a derived suffix, comparing with the system resolver for the same config.
