]> Cypherpunks repositories - gostls13.git/commit
net: pass a testing.TB to newLocal* helpers
authorBryan C. Mills <bcmills@google.com>
Thu, 9 Dec 2021 16:42:42 +0000 (11:42 -0500)
committerBryan Mills <bcmills@google.com>
Mon, 13 Dec 2021 16:42:23 +0000 (16:42 +0000)
commitb55cbbb9e76969d67fbc6e264a584ad18c2f95fa
treeed1663db1b43be6822ede330636b01b8da44c279
parentd198a36d8c1d0a251449a1cc2355485a177310c4
net: pass a testing.TB to newLocal* helpers

Passing in an explicit testing.TB gives two benefits:

1. It allows the helper to fail the test itself, instead of returning
   an error to the caller. A non-nil error invariably fails the
   calling test, and none of these callers bother to add detail to the
   error when logging it anyway so returning the error just added
   noise to the test bodies.

2. It allows the helper to use t.Cleanup to perform any needed cleanup
   tasks, which will be used in CL 370695 to clean up temp directories
   used as namespaces for unix socket paths.

For #34611

Change-Id: I805e701687c12de2caca955649369294229c10b4
Reviewed-on: https://go-review.googlesource.com/c/go/+/370696
Trust: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
20 files changed:
src/net/conn_test.go
src/net/dial_test.go
src/net/dial_unix_test.go
src/net/error_test.go
src/net/file_test.go
src/net/listen_test.go
src/net/mockserver_test.go
src/net/net_test.go
src/net/protoconn_test.go
src/net/rawconn_test.go
src/net/sendfile_test.go
src/net/server_test.go
src/net/splice_test.go
src/net/tcpsock_test.go
src/net/tcpsock_unix_test.go
src/net/timeout_test.go
src/net/udpsock_test.go
src/net/unixsock_test.go
src/net/unixsock_windows_test.go
src/net/writev_test.go