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/internal/cpu | |
| 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/internal/cpu')
| -rw-r--r-- | src/internal/cpu/cpu_test.go | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/src/internal/cpu/cpu_test.go b/src/internal/cpu/cpu_test.go index a6fe7f77f3..3bff9bed4e 100644 --- a/src/internal/cpu/cpu_test.go +++ b/src/internal/cpu/cpu_test.go @@ -8,7 +8,6 @@ import ( . "internal/cpu" "internal/godebug" "internal/testenv" - "os" "os/exec" "testing" ) @@ -26,11 +25,9 @@ func MustSupportFeatureDetection(t *testing.T) { func runDebugOptionsTest(t *testing.T, test string, options string) { MustHaveDebugOptionsSupport(t) - testenv.MustHaveExec(t) - env := "GODEBUG=" + options - cmd := exec.Command(os.Args[0], "-test.run=^"+test+"$") + cmd := exec.Command(testenv.Executable(t), "-test.run=^"+test+"$") cmd.Env = append(cmd.Env, env) output, err := cmd.CombinedOutput() |
