From bfac91a6b9aee3bc19e8ab0fb0da0e754b53ffa2 Mon Sep 17 00:00:00 2001 From: Michael Hoisie Date: Tue, 7 Dec 2010 15:57:00 -0500 Subject: [PATCH] exec.LookPath: return os.PathError instad of os.ENOENT, it's more descriptive. R=rsc CC=golang-dev https://golang.org/cl/3448042 --- src/pkg/exec/lp_unix.go | 4 ++-- src/pkg/exec/lp_windows.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pkg/exec/lp_unix.go b/src/pkg/exec/lp_unix.go index b2feecd10e..292e24fccd 100644 --- a/src/pkg/exec/lp_unix.go +++ b/src/pkg/exec/lp_unix.go @@ -29,7 +29,7 @@ func LookPath(file string) (string, os.Error) { if canExec(file) { return file, nil } - return "", os.ENOENT + return "", &os.PathError{"lookpath", file, os.ENOENT} } pathenv := os.Getenv("PATH") for _, dir := range strings.Split(pathenv, ":", -1) { @@ -41,5 +41,5 @@ func LookPath(file string) (string, os.Error) { return dir + "/" + file, nil } } - return "", os.ENOENT + return "", &os.PathError{"lookpath", file, os.ENOENT} } diff --git a/src/pkg/exec/lp_windows.go b/src/pkg/exec/lp_windows.go index 9d5dc1a144..7b56afa856 100644 --- a/src/pkg/exec/lp_windows.go +++ b/src/pkg/exec/lp_windows.go @@ -49,7 +49,7 @@ func LookPath(file string) (string, os.Error) { if f, ok := canExec(file, exts); ok { return f, nil } - return ``, os.ENOENT + return ``, &os.PathError{"lookpath", file, os.ENOENT} } if pathenv := os.Getenv(`PATH`); pathenv == `` { if f, ok := canExec(`.\`+file, exts); ok { @@ -62,5 +62,5 @@ func LookPath(file string) (string, os.Error) { } } } - return ``, os.ENOENT + return ``, &os.PathError{"lookpath", file, os.ENOENT} } -- 2.50.0