os/exec: trivial allocation removal in LookPath

R=golang-dev, bsiegert, r
CC=golang-dev
https://golang.org/cl/5549043
This commit is contained in:
Gustavo Niemeyer 2012-01-19 20:17:46 -02:00
parent ca3e6d1367
commit 01a0d39a7f

View File

@ -47,8 +47,9 @@ func LookPath(file string) (string, error) {
// Unix shell semantics: path element "" means "."
dir = "."
}
if err := findExecutable(dir + "/" + file); err == nil {
return dir + "/" + file, nil
path := dir + "/" + file
if err := findExecutable(path); err == nil {
return path, nil
}
}
return "", &Error{file, ErrNotFound}