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 Welp, have to dig deeper. On Sunday, 5 November 2017 17:12:52 UTC+1, Howard Guo wrote: > > Hello fellow gophers. > > I've a small number of go programs that only use standard library > functions without any 3rd party library dependency. A strange behaviour was > observed during compilation (go build) - most of them compile into static > executable, but few of them end up linking to glibc. Without an exception, > all of them compile into static executable when CGO_ENABLED=0 is set prior > to compilation, and their runtime behaviour doesn't change at all. > > What could be the obscure reasons for go compiler to link executable to > glibc? > > Thanks. > > Kind regards, > Howard > -- 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.