]> Cypherpunks repositories - gostls13.git/commitdiff
os/exec: trivial allocation removal in LookPath
authorGustavo Niemeyer <gustavo@niemeyer.net>
Thu, 19 Jan 2012 22:17:46 +0000 (20:17 -0200)
committerGustavo Niemeyer <gustavo@niemeyer.net>
Thu, 19 Jan 2012 22:17:46 +0000 (20:17 -0200)
R=golang-dev, bsiegert, r
CC=golang-dev
https://golang.org/cl/5549043

src/pkg/os/exec/lp_unix.go

index a221137230db379b04bab33eb6620c4e281e519b..2d3a919dc6e85348f4a54646206dab6d6ee4a505 100644 (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}