package hsup

import (
	"bitbucket.org/kardianos/osext"
	"errors"
	"log"
	"runtime"
)

var ErrNoReleases = errors.New("No releases found")

type Notifier interface {
	Notify() <-chan *Processes
}

type Processes struct {
	Rel   *Release
	Forms []Formation

	Dd        DynoDriver
	OneShot   bool
	Executors []*Executor
}

type Formation interface {
	Args() []string
	Quantity() int
	Type() string
}

func linuxAmd64Path() string {
	exe, err := osext.Executable()
	if err != nil {
		log.Fatalf("could not locate own executable:", err)
	}

	if runtime.GOOS == "linux" && runtime.GOARCH == "amd64" {
		return exe
	}

	return exe + "-linux-amd64"
}

package hsup

import (
	"errors"
	"os"
	"runtime"
)

var ErrNoReleases = errors.New("No releases found")

type Notifier interface {
	Notify() <-chan *Processes
}

type Processes struct {
	Rel   *Release
	Forms []Formation

	Dd        DynoDriver
	OneShot   bool
	Executors []*Executor
}

type Formation interface {
	Args() []string
	Quantity() int
	Type() string
}

func linuxAmd64Path() string {
	if runtime.GOOS == "linux" && runtime.GOARCH == "amd64" {
		return os.Args[0]
	}

	return os.Args[0] + "-linux-amd64"
}

--- 
+++ 
@@ -1,8 +1,9 @@
 package hsup
 
 import (
+	"bitbucket.org/kardianos/osext"
 	"errors"
-	"os"
+	"log"
 	"runtime"
 )
 
@@ -28,9 +29,14 @@
 }
 
 func linuxAmd64Path() string {
-	if runtime.GOOS == "linux" && runtime.GOARCH == "amd64" {
-		return os.Args[0]
+	exe, err := osext.Executable()
+	if err != nil {
+		log.Fatalf("could not locate own executable:", err)
 	}
 
-	return os.Args[0] + "-linux-amd64"
+	if runtime.GOOS == "linux" && runtime.GOARCH == "amd64" {
+		return exe
+	}
+
+	return exe + "-linux-amd64"
 }
Make self-executable location work when in $PATH

When invoking without a relative path, "hsup" cannot adequately find
itself (or its Linux AMD64 variant) to inject into the container.

There is no portable way to do this, so rely on an external project with
a simple interface that exists for that express purpose.
