From dceee2e983f5dab65c3905ecf40e70e15cf41b7d Mon Sep 17 00:00:00 2001 From: qmuntal Date: Mon, 24 Feb 2025 09:43:41 +0100 Subject: 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 LUCI-TryBot-Result: Go LUCI Reviewed-by: Ian Lance Taylor --- src/internal/godebug/godebug_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/internal/godebug') diff --git a/src/internal/godebug/godebug_test.go b/src/internal/godebug/godebug_test.go index fe1e67225c..fbabc657fe 100644 --- a/src/internal/godebug/godebug_test.go +++ b/src/internal/godebug/godebug_test.go @@ -78,7 +78,7 @@ func TestPanicNilRace(t *testing.T) { t.Skip("Skipping test intended for use with -race.") } if os.Getenv("GODEBUG") != "panicnil=1" { - cmd := testenv.CleanCmdEnv(testenv.Command(t, os.Args[0], "-test.run=^TestPanicNilRace$", "-test.v", "-test.parallel=2", "-test.count=1")) + cmd := testenv.CleanCmdEnv(testenv.Command(t, testenv.Executable(t), "-test.run=^TestPanicNilRace$", "-test.v", "-test.parallel=2", "-test.count=1")) cmd.Env = append(cmd.Env, "GODEBUG=panicnil=1") out, err := cmd.CombinedOutput() t.Logf("output:\n%s", out) -- cgit v1.3