mirror of
https://github.com/golang/go
synced 2024-11-22 05:44:41 -07:00
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:
parent
ca3e6d1367
commit
01a0d39a7f
@ -47,8 +47,9 @@ func LookPath(file string) (string, error) {
|
|||||||
// Unix shell semantics: path element "" means "."
|
// Unix shell semantics: path element "" means "."
|
||||||
dir = "."
|
dir = "."
|
||||||
}
|
}
|
||||||
if err := findExecutable(dir + "/" + file); err == nil {
|
path := dir + "/" + file
|
||||||
return dir + "/" + file, nil
|
if err := findExecutable(path); err == nil {
|
||||||
|
return path, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return "", &Error{file, ErrNotFound}
|
return "", &Error{file, ErrNotFound}
|
||||||
|
Loading…
Reference in New Issue
Block a user