3 ms·
By default, go compiles binaries linked to libc to use the system DNS resolver. It does re-implement a DNS resolver but it's only used if CGO is disabled at com
by dward 8y ago
By default, go compiles binaries linked to libc to use the system DNS resolver. It does re-implement a DNS resolver but it's only used if CGO is disabled at compilation time.
- axaxs 8y agoThat's only half right. It does link to libc, but the default behavior on linux is to use Go unless some conditions are met.
- dward 8y agoUse go for what? DNS resolution? The default behavior is to use the system DNS resolver. The Go resolver will be used if the system is resolver is not avaialble (e.g. if the binary is compiled as pure go) or if the net.Resolver has the PreferGo flag set (which is false by default). https://github.com/golang/go/blob/541f9c0345d4ec52d9f4be5913bf8097f687e819/src/net/lookup.go#L108-L111 https://github.com/golang/go/blob/541f9c0345d4ec52d9f4be5913...