From e3c540875a05749b20472baadaf80685c6fb97cc Mon Sep 17 00:00:00 2001 From: ThinhNT Date: Thu, 22 Mar 2018 10:49:53 +0700 Subject: [PATCH] - fix wrong GOBIN when GOPATH includes multi directories - support custom run method to config path to binary to run --- realize/cli.go | 3 ++- realize/projects.go | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/realize/cli.go b/realize/cli.go index 28a36b5..24982f3 100644 --- a/realize/cli.go +++ b/realize/cli.go @@ -65,7 +65,8 @@ func init() { if build.Default.GOPATH == "" { log.Fatal("$GOPATH isn't set properly") } - if err := os.Setenv("GOBIN", filepath.Join(build.Default.GOPATH, "bin")); err != nil { + path := filepath.SplitList(build.Default.GOPATH) + if err := os.Setenv("GOBIN", filepath.Join(path[len(path)-1], "bin")); err != nil { log.Fatal(err) } } diff --git a/realize/projects.go b/realize/projects.go index 993f080..3017272 100644 --- a/realize/projects.go +++ b/realize/projects.go @@ -582,6 +582,9 @@ func (p *Project) run(path string, stream chan Response, stop <-chan bool) (err name = filepath.Base(dirPath) } path = filepath.Join(dirPath, name) + if p.Tools.Run.Method != "" { + path = p.Tools.Run.Method + } if _, err := os.Stat(path); err == nil { build = exec.Command(path, args...) } else if _, err := os.Stat(path + RExtWin); err == nil {