https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63731
--- Comment #10 from Yohei Ueda <yohei at jp dot ibm.com> --- https://code.google.com/p/go/source/browse/src/net/lookup_unix.go#63 func lookupIP(host string) (addrs []IP, err error) { addrs, err, ok := cgoLookupIP(host) if !ok { addrs, err = goLookupIP(host) } return } This code shows how fallback works. If cgoLookup returns ok == false, then pure-Go goLookupIP is called. When the netgo tag is set, ok is always false. https://code.google.com/p/go/source/browse/src/net/cgo_stub.go#5 When the netgo tag is not set, ok is always true. https://code.google.com/p/go/source/browse/src/net/cgo_unix.go#147 https://code.google.com/p/go/source/browse/src/net/cgo_unix.go#84 If cgoLookupIP can also return ok == false when no nss is available, goLookupIP will be called. This is my first idea. https://code.google.com/p/go/source/browse/src/net/cgo_unix.go#116 However, I realized that we cannot easily distinguish the "not found" errors. getaddrinfo returns "not found" in both cases of invalid hostname lookups and static binaries. If cgoLookup returns ok == false even when an invalid host name is looked up with nss available, goLookupIP also looks it up again, so IP lookup occurs twice, and both fails with "not found" error. I don't think this is desired behavior.