mirror of
https://github.com/beego/bee.git
synced 2025-07-04 11:40:17 +00:00
add parms for go executable file path!
This commit is contained in:
@ -28,7 +28,7 @@ import (
|
||||
)
|
||||
|
||||
var CmdRun = &commands.Command{
|
||||
UsageLine: "run [appname] [watchall] [-main=*.go] [-downdoc=true] [-gendoc=true] [-vendor=true] [-e=folderToExclude] [-ex=extraPackageToWatch] [-tags=goBuildTags] [-runmode=BEEGO_RUNMODE]",
|
||||
UsageLine: "run [-gobin=go] [appname] [watchall] [-main=*.go] [-downdoc=true] [-gendoc=true] [-vendor=true] [-e=folderToExclude] [-ex=extraPackageToWatch] [-tags=goBuildTags] [-runmode=BEEGO_RUNMODE]",
|
||||
Short: "Run the application by starting a local development server",
|
||||
Long: `
|
||||
Run command will supervise the filesystem of the application for any changes, and recompile/restart it.
|
||||
@ -64,8 +64,10 @@ var (
|
||||
extraPackages utils.StrFlags
|
||||
)
|
||||
var started = make(chan bool)
|
||||
var cmdName = utils.DocValue("go")
|
||||
|
||||
func init() {
|
||||
CmdRun.Flag.Var(&cmdName, "gobin", "go executable file path or alias")
|
||||
CmdRun.Flag.Var(&mainFiles, "main", "Specify main go files.")
|
||||
CmdRun.Flag.Var(&gendoc, "gendoc", "Enable auto-generate the docs.")
|
||||
CmdRun.Flag.Var(&downdoc, "downdoc", "Enable auto-download of the swagger file if it does not exist.")
|
||||
|
@ -118,8 +118,6 @@ func AutoBuild(files []string, isgenerate bool) {
|
||||
|
||||
os.Chdir(currpath)
|
||||
|
||||
cmdName := "go"
|
||||
|
||||
var (
|
||||
err error
|
||||
stderr bytes.Buffer
|
||||
@ -127,7 +125,7 @@ func AutoBuild(files []string, isgenerate bool) {
|
||||
// For applications use full import path like "github.com/.../.."
|
||||
// are able to use "go install" to reduce build time.
|
||||
if config.Conf.GoInstall {
|
||||
icmd := exec.Command(cmdName, "install", "-v")
|
||||
icmd := exec.Command(string(cmdName), "install", "-v")
|
||||
icmd.Stdout = os.Stdout
|
||||
icmd.Stderr = os.Stderr
|
||||
icmd.Env = append(os.Environ(), "GOGC=off")
|
||||
@ -148,7 +146,7 @@ func AutoBuild(files []string, isgenerate bool) {
|
||||
}
|
||||
appName := appname
|
||||
if err == nil {
|
||||
|
||||
|
||||
if runtime.GOOS == "windows" {
|
||||
appName += ".exe"
|
||||
}
|
||||
@ -160,7 +158,7 @@ func AutoBuild(files []string, isgenerate bool) {
|
||||
}
|
||||
args = append(args, files...)
|
||||
|
||||
bcmd := exec.Command(cmdName, args...)
|
||||
bcmd := exec.Command(string(cmdName), args...)
|
||||
bcmd.Env = append(os.Environ(), "GOGC=off")
|
||||
bcmd.Stderr = &stderr
|
||||
err = bcmd.Run()
|
||||
|
Reference in New Issue
Block a user