From: qmuntal Date: Thu, 8 Jan 2026 09:25:44 +0000 (+0100) Subject: net: don't ignore errors in TestUnixUnlink X-Git-Tag: go1.26rc3~11^2~20 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=5741608de26f06488e771fd7b3b35ca2ca4c93a6;p=gostls13.git net: don't ignore errors in TestUnixUnlink TestUnixUnlink calls some functions and methods that can fail, but it ignores the returned errors. This test is flaky on Windows, and those errors should be checked to help diagnose the problem. Updates #75282 Updates #76582 Updates #77038 Change-Id: Ia868762a4c0b94a7255d57add63777568caa6cd2 Reviewed-on: https://go-review.googlesource.com/c/go/+/734720 Reviewed-by: Florian Lehner LUCI-TryBot-Result: Go LUCI Reviewed-by: Damien Neil Reviewed-by: Dmitri Shuralyov --- diff --git a/src/net/unixsock_test.go b/src/net/unixsock_test.go index f6c5679f42..3e4a14b255 100644 --- a/src/net/unixsock_test.go +++ b/src/net/unixsock_test.go @@ -375,6 +375,17 @@ func TestUnixUnlink(t *testing.T) { } return l.(*UnixListener) } + fileListener := func(t *testing.T, l *UnixListener) (*os.File, Listener) { + f, err := l.File() + if err != nil { + t.Fatal(err) + } + ln, err := FileListener(f) + if err != nil { + t.Fatal(err) + } + return f, ln + } checkExists := func(t *testing.T, desc string) { if _, err := os.Stat(name); err != nil { t.Fatalf("unix socket does not exist %s: %v", desc, err) @@ -397,8 +408,7 @@ func TestUnixUnlink(t *testing.T) { // FileListener should not. t.Run("FileListener", func(t *testing.T) { l := listen(t) - f, _ := l.File() - l1, _ := FileListener(f) + f, l1 := fileListener(t, l) checkExists(t, "after FileListener") f.Close() checkExists(t, "after File close") @@ -444,8 +454,7 @@ func TestUnixUnlink(t *testing.T) { t.Run("FileListener/SetUnlinkOnClose(true)", func(t *testing.T) { l := listen(t) - f, _ := l.File() - l1, _ := FileListener(f) + f, l1 := fileListener(t, l) checkExists(t, "after FileListener") l1.(*UnixListener).SetUnlinkOnClose(true) f.Close() @@ -457,8 +466,7 @@ func TestUnixUnlink(t *testing.T) { t.Run("FileListener/SetUnlinkOnClose(false)", func(t *testing.T) { l := listen(t) - f, _ := l.File() - l1, _ := FileListener(f) + f, l1 := fileListener(t, l) checkExists(t, "after FileListener") l1.(*UnixListener).SetUnlinkOnClose(false) f.Close()