mirror of https://github.com/beego/bee.git
support ldflags
This commit is contained in:
parent
c085194507
commit
ee489ba3bb
|
@ -46,6 +46,8 @@ var (
|
||||||
excludedPaths utils.StrFlags
|
excludedPaths utils.StrFlags
|
||||||
// Pass through to -tags arg of "go build"
|
// Pass through to -tags arg of "go build"
|
||||||
buildTags string
|
buildTags string
|
||||||
|
// Pass through to -ldflags arg of "go build"
|
||||||
|
buildLDFlags string
|
||||||
// Application path
|
// Application path
|
||||||
currpath string
|
currpath string
|
||||||
// Application name
|
// Application name
|
||||||
|
@ -72,6 +74,7 @@ func init() {
|
||||||
CmdRun.Flag.Var(&excludedPaths, "e", "List of paths to exclude.")
|
CmdRun.Flag.Var(&excludedPaths, "e", "List of paths to exclude.")
|
||||||
CmdRun.Flag.BoolVar(&vendorWatch, "vendor", false, "Enable watch vendor folder.")
|
CmdRun.Flag.BoolVar(&vendorWatch, "vendor", false, "Enable watch vendor folder.")
|
||||||
CmdRun.Flag.StringVar(&buildTags, "tags", "", "Set the build tags. See: https://golang.org/pkg/go/build/")
|
CmdRun.Flag.StringVar(&buildTags, "tags", "", "Set the build tags. See: https://golang.org/pkg/go/build/")
|
||||||
|
CmdRun.Flag.StringVar(&buildLDFlags, "ldflags", "", "Set the build ldflags. See: https://golang.org/pkg/go/build/")
|
||||||
CmdRun.Flag.StringVar(&runmode, "runmode", "", "Set the Beego run mode.")
|
CmdRun.Flag.StringVar(&runmode, "runmode", "", "Set the Beego run mode.")
|
||||||
CmdRun.Flag.StringVar(&runargs, "runargs", "", "Extra args to run application")
|
CmdRun.Flag.StringVar(&runargs, "runargs", "", "Extra args to run application")
|
||||||
CmdRun.Flag.Var(&extraPackages, "ex", "List of extra package to watch.")
|
CmdRun.Flag.Var(&extraPackages, "ex", "List of extra package to watch.")
|
||||||
|
|
|
@ -25,7 +25,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/beego/bee/config"
|
"github.com/beego/bee/config"
|
||||||
beeLogger "github.com/beego/bee/logger"
|
"github.com/beego/bee/logger"
|
||||||
"github.com/beego/bee/logger/colors"
|
"github.com/beego/bee/logger/colors"
|
||||||
"github.com/beego/bee/utils"
|
"github.com/beego/bee/utils"
|
||||||
"github.com/fsnotify/fsnotify"
|
"github.com/fsnotify/fsnotify"
|
||||||
|
@ -158,6 +158,9 @@ func AutoBuild(files []string, isgenerate bool) {
|
||||||
if buildTags != "" {
|
if buildTags != "" {
|
||||||
args = append(args, "-tags", buildTags)
|
args = append(args, "-tags", buildTags)
|
||||||
}
|
}
|
||||||
|
if buildLDFlags != "" {
|
||||||
|
args = append(args, "-ldflags", buildLDFlags)
|
||||||
|
}
|
||||||
args = append(args, files...)
|
args = append(args, files...)
|
||||||
|
|
||||||
bcmd := exec.Command(cmdName, args...)
|
bcmd := exec.Command(cmdName, args...)
|
||||||
|
|
Loading…
Reference in New Issue