diff options
| author | qmuntal <quimmuntal@gmail.com> | 2025-02-24 09:43:41 +0100 |
|---|---|---|
| committer | Quim Muntal <quimmuntal@gmail.com> | 2025-02-24 11:03:10 -0800 |
| commit | dceee2e983f5dab65c3905ecf40e70e15cf41b7d (patch) | |
| tree | 90d8aec778115127028196a5de6b321008252b92 /src/net | |
| parent | 2ee775fd9b58247618cf8bc06935f33875bdc872 (diff) | |
| download | go-dceee2e983f5dab65c3905ecf40e70e15cf41b7d.tar.xz | |
all: use testenv.Executable instead of os.Executable and os.Args[0]
In test files, using testenv.Executable is more reliable than
os.Executable or os.Args[0].
Change-Id: I88e577efeabc20d02ada27bf706ae4523129128e
Reviewed-on: https://go-review.googlesource.com/c/go/+/651955
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Diffstat (limited to 'src/net')
| -rw-r--r-- | src/net/mockserver_test.go | 2 | ||||
| -rw-r--r-- | src/net/net_windows_test.go | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/net/mockserver_test.go b/src/net/mockserver_test.go index 4d5e79a592..63802c575e 100644 --- a/src/net/mockserver_test.go +++ b/src/net/mockserver_test.go @@ -548,7 +548,7 @@ func startTestSocketPeer(t testing.TB, conn Conn, op string, chunkSize, totalSiz return nil, err } - cmd := testenv.Command(t, os.Args[0]) + cmd := testenv.Command(t, testenv.Executable(t)) cmd.Env = []string{ "GO_NET_TEST_TRANSFER=1", "GO_NET_TEST_TRANSFER_OP=" + op, diff --git a/src/net/net_windows_test.go b/src/net/net_windows_test.go index 480e89dfd7..bc3171b4ea 100644 --- a/src/net/net_windows_test.go +++ b/src/net/net_windows_test.go @@ -100,7 +100,7 @@ func TestAcceptIgnoreSomeErrors(t *testing.T) { defer ln.Close() // Start child process that connects to our listener. - cmd := exec.Command(os.Args[0], "-test.run=TestAcceptIgnoreSomeErrors") + cmd := exec.Command(testenv.Executable(t), "-test.run=TestAcceptIgnoreSomeErrors") cmd.Env = append(os.Environ(), "GOTEST_DIAL_ADDR="+ln.Addr().String()) stdout, err := cmd.StdoutPipe() if err != nil { |
