aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/pprof
diff options
context:
space:
mode:
authorKir Kolyshkin <kolyshkin@gmail.com>2024-08-29 19:00:00 -0700
committerDamien Neil <dneil@google.com>2024-09-03 18:03:19 +0000
commitf26c29723f372284ff7dc0dbf30bae5561a3e618 (patch)
tree86f66102d429a195e74e58c85f5cdf70a9645fef /src/cmd/pprof
parentb4d4744059c0c9632c034af145deb161995f2f32 (diff)
downloadgo-f26c29723f372284ff7dc0dbf30bae5561a3e618.tar.xz
cmd: use testenv.Executable helper
Change-Id: I25ac0e8d25d760bfde3bb7700f0feaa23f3e8ab1 Reviewed-on: https://go-review.googlesource.com/c/go/+/609302 Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'src/cmd/pprof')
-rw-r--r--src/cmd/pprof/pprof_test.go18
1 files changed, 1 insertions, 17 deletions
diff --git a/src/cmd/pprof/pprof_test.go b/src/cmd/pprof/pprof_test.go
index 494cd8f24c..9afd817a4e 100644
--- a/src/cmd/pprof/pprof_test.go
+++ b/src/cmd/pprof/pprof_test.go
@@ -10,7 +10,6 @@ import (
"path/filepath"
"runtime"
"strings"
- "sync"
"testing"
)
@@ -28,24 +27,9 @@ func TestMain(m *testing.M) {
// pprofPath returns the path to the "pprof" binary to run.
func pprofPath(t testing.TB) string {
- t.Helper()
- testenv.MustHaveExec(t)
-
- pprofPathOnce.Do(func() {
- pprofExePath, pprofPathErr = os.Executable()
- })
- if pprofPathErr != nil {
- t.Fatal(pprofPathErr)
- }
- return pprofExePath
+ return testenv.Executable(t)
}
-var (
- pprofPathOnce sync.Once
- pprofExePath string
- pprofPathErr error
-)
-
// See also runtime/pprof.cpuProfilingBroken.
func mustHaveCPUProfiling(t *testing.T) {
switch runtime.GOOS {