diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2020-12-18 18:20:12 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2020-12-19 17:03:07 +0100 |
commit | 10ae7c3210cd1add14d3750aa9512a87df0e1146 (patch) | |
tree | 6fa7eb1e9bfe093f3b611bbb286aefe591e1dc7a /tpl/internal/go_templates/testenv/testenv.go | |
parent | ae2d1bd52df0099190ef9195666d0788708b0385 (diff) |
Improve LookPath
Diffstat (limited to 'tpl/internal/go_templates/testenv/testenv.go')
-rw-r--r-- | tpl/internal/go_templates/testenv/testenv.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/tpl/internal/go_templates/testenv/testenv.go b/tpl/internal/go_templates/testenv/testenv.go index 90044570d..f5ea398fb 100644 --- a/tpl/internal/go_templates/testenv/testenv.go +++ b/tpl/internal/go_templates/testenv/testenv.go @@ -13,7 +13,6 @@ package testenv import ( "errors" "flag" - "github.com/gohugoio/hugo/tpl/internal/go_templates/cfg" "os" "os/exec" "path/filepath" @@ -22,6 +21,9 @@ import ( "strings" "sync" "testing" + + "github.com/cli/safeexec" + "github.com/gohugoio/hugo/tpl/internal/go_templates/cfg" ) // Builder reports the name of the builder running this test @@ -111,7 +113,7 @@ func GoTool() (string, error) { if _, err := os.Stat(path); err == nil { return path, nil } - goBin, err := exec.LookPath("go" + exeSuffix) + goBin, err := safeexec.LookPath("go" + exeSuffix) if err != nil { return "", errors.New("cannot find go tool: " + err.Error()) } @@ -162,7 +164,7 @@ func MustHaveExecPath(t testing.TB, path string) { err, found := execPaths.Load(path) if !found { - _, err = exec.LookPath(path) + _, err = safeexec.LookPath(path) err, _ = execPaths.LoadOrStore(path, err) } if err != nil { |