Skip to content

Commit

Permalink
nettest: fix Unix socket test on macOS
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Dmitri Shuralyov <[email protected]>
Reviewed-by: Dmitri Shuralyov <[email protected]>
Auto-Submit: Russ Cox <[email protected]>
Run-TryBot: Russ Cox <[email protected]>
  • Loading branch information
rsc authored and gopherbot committed Aug 12, 2022
1 parent 4c34ddd commit 3211cb9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion nettest/nettest.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 3211cb9

Please sign in to comment.