"That is incorrect: DNS lookups happen in userspace, not the kernel."
That's not even a nit, it's just plain wrong. While getaddrinfo is a library function it will invoke a torrent of system calls - socket, connect, sendto, recvmesg, open, close, fstat etc. Unless a host is found in a local cache or in a file specified in nsswitch.conf, it invariably involves sending and receiving packets over the network. These network round trips are all a part of the "the query" and you can't have those without system calls. The query is a query to a distributed database.
"By default the pure Go resolver is used, because a blocked DNS request consumes only a goroutine, while a blocked C call consumes an operating system thread. When cgo is available, the cgo-based resolver is used instead under a variety of conditions: on systems that do not let programs make direct DNS requests (OS X) ..." [1]. There is also a litany of other conditions that will cause it to use getaddrinfo instead. So it's really OS dependent.
Windows also used the libc resolver until Go 1.18.
Comments
That's not even a nit, it's just plain wrong. While getaddrinfo is a library function it will invoke a torrent of system calls - socket, connect, sendto, recvmesg, open, close, fstat etc. Unless a host is found in a local cache or in a file specified in nsswitch.conf, it invariably involves sending and receiving packets over the network. These network round trips are all a part of the "the query" and you can't have those without system calls. The query is a query to a distributed database.
This is also not incorrect:
"By default the pure Go resolver is used, because a blocked DNS request consumes only a goroutine, while a blocked C call consumes an operating system thread. When cgo is available, the cgo-based resolver is used instead under a variety of conditions: on systems that do not let programs make direct DNS requests (OS X) ..." [1]. There is also a litany of other conditions that will cause it to use getaddrinfo instead. So it's really OS dependent.
Windows also used the libc resolver until Go 1.18.
[1] https://pkg.go.dev/net