Merge pull request #171 from thnt/fix_GOBIN_support_custom_run_method

fix wrong GOBIN, support custom run method
This commit is contained in:
Alessio Pracchia 2018-03-27 13:57:37 +02:00 committed by GitHub
commit 8481c0293b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -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)
}
}

View File

@ -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 {