FAQ
Is there some different way to enable the internal go DNS resolver for go
1.4?

With go 1.3.3, I used this method to enable go's internal resolver:

$ cd $GOROOT/src

$ go install -a -tags netgo std

$ cd $PROJECT

$ go build -tags netgo test.go

$ ldd test
         not a dynamic executable

With go 1.4, the same procedure produces this:

$ ldd test
         linux-vdso.so.1 => (0x00007fffdf374000)
         libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0
(0x00007f5b9d13c000)
         libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f5b9cd7f000)
         /lib64/ld-linux-x86-64.so.2 (0x00007f5b9d362000)

An strace shows the use of libc's DNS resolution behavior:

...
[pid 32438] connect(3, {sa_family=AF_UNSPEC,
sa_data="\0\0\0\0\0\0\0\0\0\0\0\0\0\0"}, 16) = 0
[pid 32438] connect(3, {sa_family=AF_INET, sin_port=htons(0),
sin_addr=inet_addr("74.125.224.97")}, 16) = 0
[pid 32438] getsockname(3, {sa_family=AF_INET6, sin6_port=htons(41432),
inet_pton(AF_INET6, "::ffff:x.x.x.x", &sin6_addr), sin6_flowinfo=0,
sin6_scope_id=0}, [28]) = 0
[pid 32438] connect(3, {sa_family=AF_UNSPEC,
sa_data="\0\0\0\0\0\0\0\0\0\0\0\0\0\0"}, 16) = 0
[pid 32438] connect(3, {sa_family=AF_INET, sin_port=htons(0),
sin_addr=inet_addr("74.125.224.101")}, 16) = 0
[pid 32438] getsockname(3, {sa_family=AF_INET6, sin6_port=htons(47992),
inet_pton(AF_INET6, "::ffff:x.x.x.x", &sin6_addr), sin6_flowinfo=0,
sin6_scope_id=0}, [28]) = 0
[pid 32438] connect(3, {sa_family=AF_UNSPEC,
sa_data="\0\0\0\0\0\0\0\0\0\0\0\0\0\0"}, 16) = 0
[pid 32438] connect(3, {sa_family=AF_INET, sin_port=htons(0),
sin_addr=inet_addr("74.125.224.104")}, 16) = 0
[pid 32438] getsockname(3, {sa_family=AF_INET6, sin6_port=htons(47978),
inet_pton(AF_INET6, "::ffff:x.x.x.x", &sin6_addr), sin6_flowinfo=0,
sin6_scope_id=0}, [28]) = 0
[pid 32438] connect(3, {sa_family=AF_UNSPEC,
sa_data="\0\0\0\0\0\0\0\0\0\0\0\0\0\0"}, 16) = 0
[pid 32438] connect(3, {sa_family=AF_INET, sin_port=htons(0),
sin_addr=inet_addr("74.125.224.99")}, 16) = 0
[pid 32438] getsockname(3, {sa_family=AF_INET6, sin6_port=htons(60349),
inet_pton(AF_INET6, "::ffff:x.x.x.x", &sin6_addr), sin6_flowinfo=0,
sin6_scope_id=0}, [28]) = 0
...

Test program http://play.golang.org/p/T1LVt_q2f3

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Mikio Hara at Dec 12, 2014 at 5:01 am

    On Fri, Dec 12, 2014 at 1:38 PM, wrote:

    Is there some different way to enable the internal go DNS resolver for go
    1.4?
    sure, don't use go install or build command for rebuilding stdlib.
    $ go install -a -tags netgo std
    see http://golang.org/doc/go1.4#gocmd, golang.org/issue/8290.

    --
    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+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedDec 12, '14 at 4:38a
activeDec 12, '14 at 5:01a
posts2
users2
websitegolang.org

2 users in discussion

Mikio Hara: 1 post Jason: 1 post

People

Translate

site design / logo © 2022 Grokbase