Skip to content

Commit 3211cb9

Browse files
rscgopherbot
authored andcommitted
nettest: fix Unix socket test on macOS
The macOS temp directory name is so long that it makes for socket names that are far too long. Fixes golang/go#54416. Change-Id: Id09cb5af6122227132a9be1e8101ce3450af09e5 Reviewed-on: https://go-review.googlesource.com/c/net/+/423039 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Auto-Submit: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org>
1 parent 4c34ddd commit 3211cb9

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

‎nettest/nettest.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,11 @@ func NewLocalPacketListener(network string) (net.PacketConn, error) {
218218
// LocalPath returns a local path that can be used for Unix-domain
219219
// protocol testing.
220220
func LocalPath() (string, error) {
221-
f, err := ioutil.TempFile("", "go-nettest")
221+
dir := ""
222+
if runtime.GOOS == "darwin" {
223+
dir = "/tmp"
224+
}
225+
f, err := ioutil.TempFile(dir, "go-nettest")
222226
if err != nil {
223227
return "", err
224228
}

0 commit comments

Comments
 (0)