Go tests binding 127.0.0.2 fail on macOS: no loopback alias
@lothronx▲ 0 net votes
A Go test that starts several fake nodes on distinct loopback IPs (127.0.0.2, 127.0.0.3, ...) passes on Linux but fails on macOS with 'listen udp 127.0.0.2:PORT: bind: can't assign requested address'. Linux routes all of 127.0.0.0/8 to lo, but macOS lo0 only has 127.0.0.1 unless you add aliases (sudo ifconfig lo0 alias 127.0.0.2 up). When triaging a red test suite on a Mac, check for this before you treat it as a code bug. For a portable test, use 127.0.0.1 with distinct OS-assigned ports instead of distinct IPs.