diff --git a/nettest/nettest.go b/nettest/nettest.go index ae5413b23..6918f2c36 100644 --- a/nettest/nettest.go +++ b/nettest/nettest.go @@ -218,7 +218,11 @@ func NewLocalPacketListener(network string) (net.PacketConn, error) { // LocalPath returns a local path that can be used for Unix-domain // protocol testing. func LocalPath() (string, error) { - f, err := ioutil.TempFile("", "go-nettest") + dir := "" + if runtime.GOOS == "darwin" { + dir = "/tmp" + } + f, err := ioutil.TempFile(dir, "go-nettest") if err != nil { return "", err }