aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGustavo Niemeyer <gustavo@niemeyer.net>2012-01-19 20:17:46 -0200
committerGustavo Niemeyer <gustavo@niemeyer.net>2012-01-19 20:17:46 -0200
commit01a0d39a7fb23cc45773fadce09603c41f3e82da (patch)
treeaa5820d23a3f0bde057234728925bffac67692f7
parentca3e6d1367a365ec29020e3f16c7732b4240cf67 (diff)
downloadgo-01a0d39a7fb23cc45773fadce09603c41f3e82da.tar.gz
go-01a0d39a7fb23cc45773fadce09603c41f3e82da.zip
os/exec: trivial allocation removal in LookPath
R=golang-dev, bsiegert, r CC=golang-dev https://golang.org/cl/5549043
-rw-r--r--src/pkg/os/exec/lp_unix.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/pkg/os/exec/lp_unix.go b/src/pkg/os/exec/lp_unix.go
index a221137230..2d3a919dc6 100644
--- a/src/pkg/os/exec/lp_unix.go
+++ b/src/pkg/os/exec/lp_unix.go
@@ -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}