- fix wrong GOBIN when GOPATH includes multi directories
- support custom run method to config path to binary to run
This commit is contained in:
parent
3ad56dd80c
commit
e3c540875a
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue