>> I don’t understand why ping does not have the same problem. Ping is not >> based on C library? >> > > Looking at the source code, the ping command on macOS use gethostbyname2() > [1][2], while the Go on macOS use C library through getaddrinfo [3][4].
If so, I'd consider it as a performance bug of net.Dial() on macOS. After all, the following command runs quickly to resolve an IP address from a name (suffixed with .local) in /etc/hosts much faster. So net.Dial() could (and probably should) just use this (or something along this line) on macOS to fix the performance problem. net.ResolveIPAddr("ip4", addr) -- Regards, Peng -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CABrM6w%3Dfb_BXwdbcfJzfrMafRhfj6mxzVZ_5udx9yo5iFpWgSw%40mail.gmail.com.