On Fri, Nov 7, 2014 at 2:29 AM, Simon Menke <
simon...@gmail.com> wrote:
>
> Sure, the return types are different. But, when reading through the code,
> this doesn't seem to be the only difference.
> LookupIP seems to be merging its requests while LookupHost doesn't seem to
> be doing this.
This is only a difference in implementation, not in effect. Both
functions look up a name in DNS and return IP addresses.
When LookupIP was introduced, it was slightly different in that
LookupHost looked in /etc/hosts and LookupIP did not. That is,
LookupHost first looked in /etc/hosts, and then, if it didn't find
anything, called LookupIP. So LookupIP only used DNS and LookupHost
check /etc/hosts and then fell back to DNS.
However, this distinction was only relevant when using the Go native
resolver, not when using getaddrinfo which is now the default.
Further,
http://codereview.appspot.com/4431054 changed LookupIP to use
/etc/hosts.
So now there is basically no difference between LookupHost and
LookupIP. We should encourage people to use LookupIP.
Ian