mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
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:
parent
e6a934a1d9
commit
59a47732dd
5 changed files with 49 additions and 6 deletions
|
|
@ -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}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue