I have started compiling all my go programs with netgo, which is the native resolver, instead of using the glibc resolver.
As a result, I have far fewer issues with memory spiraling out of control and random crashes. As a bonus, I get an actual static binary (unless using something else that pulls in cgo).
IIRC the only reason the native resolver is not used by default is because the OSX firewall triggers if an app tried to do its own DNS resolution. There have been some attempts to make netgo the default at least on Linux due to issues like this but it’s never gained traction.