https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63731

--- Comment #12 from Yohei Ueda <yohei at jp dot ibm.com> ---
"pure-Go goLookupIP" means that goLookupIP is written in Go as usual.
https://code.google.com/p/go/source/browse/src/net/dnsclient_unix.go#364

cgoLookupIP uses getaddrinfo via CGO unless the netgo tag is set.
https://code.google.com/p/go/source/browse/src/net/cgo_unix.go#147

Fallback means that goLookupIP is called when cgoLookup fails with ok == false
in this code.
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
}

When code that uses LookupHost is compiled with "go build -ldflags '-linkmode
external -extldflags -static' -a -tags netgo", the Go standard library
including cgoLookupIP is rebuilt. In this case, cgoLookupIP always returns ok
== false as defined here.
https://code.google.com/p/go/source/browse/src/net/cgo_stub.go#19
func cgoLookupIP(name string) (addrs []IP, err error, completed bool) {
        return nil, nil, false
}

This leads to calling goLookupIP from lookupIP. I called this mechanism
"fallback".

Reply via email to