What does the future hold for cgo? Yesterday I ran into erratic DNS success with a cross compiled program, win to lin. Haven't had a chance to look further, but I'm wondering when I'll run into similar snags again.
What does the future hold for cgo? Yesterday I ran into erratic DNS success with a cross compiled program, win to lin. Haven't had a chance to look further, but I'm wondering when I'll run into similar snags again.
Have a Go: package main
import (
"fmt"
"net"
"os"
)
func main() {
hostname := "feeds.feedburner.com"
if len(os.Args) > 1 {
hostname = os.Args[1]
}
addr, err := net.LookupHost(hostname)
if err != nil {
fmt.Printf("err: %v", err.Error())
} else {
fmt.Printf("addr: %v", addr)
}
}
set GOOS=linux
set GOARCH=amd64
set CGO_ENABLED=0I do not have windows box to crosscompile any longer. I did test go 1.4 rc2 with CGO_ENABLED=0, which builds a static binary, and it gives -
addr: [74.125.192.118 2607:f8b0:4001:c00::76]
Are you seeing different behavior? Please describe...I'll see if I can look into it.
$ ./dns-win-xc.bin
err: lookup feeds.feedburner.com on [178.22.66.167]:53: no such host
$ ./dns-lin.bin
addr: [173.194.116.64 173.194.116.69 173.194.116.71 173.194.116.65 173.194.116.73 173.194.116.70 173.194.116.67 173.194.116.66 173.194.116.72 173.194.116.78 173.194.116.68 2a00:1450:400c:c0a::76]
Win 8.1, go1.3.3., Centos 7. There's a downvoter for some reason, maybe they have something to add...? Don't let me lead you astray - I haven't yet read that article I linked to, but a quick glimpse suggested to me that this isn't a bug.Secondly, your dns-lin.bin, is that with go built with CGO_ENABLED=0? Ie...if you ldd both files, do they both claim to be statically linked?
If you'd like to continue by email, please click my username.
Thanks