From ca85df87d957d4c1339e0700f25094afcfa33826 Mon Sep 17 00:00:00 2001 From: Alex Dadgar Date: Wed, 30 Sep 2015 14:30:09 -0700 Subject: [PATCH] Correctly scan the CWD for the nomad executable --- helper/discover/discover.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/helper/discover/discover.go b/helper/discover/discover.go index 8d1416ab6f5..b683e95a793 100644 --- a/helper/discover/discover.go +++ b/helper/discover/discover.go @@ -32,11 +32,6 @@ func NomadExecutable() (string, error) { } // Check the CWD. - bin = filepath.Join(os.Getenv("GOPATH"), "bin", nomadExe) - if _, err := os.Stat(bin); err == nil { - return bin, nil - } - pwd, err := os.Getwd() if err != nil { return "", fmt.Errorf("Could not find Nomad executable (%v): %v", err) @@ -47,5 +42,11 @@ func NomadExecutable() (string, error) { return bin, nil } + // Check CWD/bin + bin = filepath.Join(pwd, "bin", nomadExe) + if _, err := os.Stat(bin); err == nil { + return bin, nil + } + return "", fmt.Errorf("Could not find Nomad executable (%v)", nomadExe) }