exec: use custom error for LookPath

Make the error message and the needed action more obvious
when a command isn't found to obtain the source code
of a project.  Users seem to strugle with the existing
wording in practice.

R=rsc
CC=golang-dev
https://golang.org/cl/4058047
This commit is contained in:
Gustavo Niemeyer 2011-02-01 12:12:51 -05:00 committed by Russ Cox
parent e6a934a1d9
commit 59a47732dd
5 changed files with 49 additions and 6 deletions

View file

@ -29,7 +29,7 @@ func LookPath(file string) (string, os.Error) {
if canExec(file) {
return file, nil
}
return "", &os.PathError{"lookpath", file, os.ENOENT}
return "", &PathError{file}
}
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.PathError{"lookpath", file, os.ENOENT}
return "", &PathError{file}
}