On Tue, Nov 7, 2017 at 1:28 AM, Howard Guo <guohou...@gmail.com> wrote: > Just noticed this statement from src/net/net.go: > > ------------------ > On Unix systems, the resolver has two options for resolving names. > It can use a pure Go resolver that sends DNS requests directly to the > servers > listed in /etc/resolv.conf, or it can use a cgo-based resolver that calls C > library routines such as getaddrinfo and getnameinfo. > ----------------- > > However, using its recommended method to force usage of Go resolver still > results in a dynamic binary: > > export GODEBUG=netdns=go
Setting the GODEBUG environment variable changes the behavior at run time. It does not affect how the program is built. As you've seen setting CGO_ENABLED=0 is a quick way to ensure that you get a static binary with no C code. But this does mean that the os/user package, and less frequently the net package, will not behave correctly in certain environments. If you are running in a Docker container or otherwise constrained environment this does not matter. Ian -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.