mirror of
https://github.com/beego/bee.git
synced 2024-11-25 20:10:55 +00:00
Support go build tags (issue #149)
This commit is contained in:
parent
1566ca7da1
commit
19b8add1c5
6
run.go
6
run.go
@ -26,7 +26,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var cmdRun = &Command{
|
var cmdRun = &Command{
|
||||||
UsageLine: "run [appname] [watchall] [-main=*.go] [-downdoc=true] [-gendoc=true] [-e=Godeps -e=folderToExclude]",
|
UsageLine: "run [appname] [watchall] [-main=*.go] [-downdoc=true] [-gendoc=true] [-e=Godeps -e=folderToExclude] [-tags=goBuildTags]",
|
||||||
Short: "run the app and start a Web server for development",
|
Short: "run the app and start a Web server for development",
|
||||||
Long: `
|
Long: `
|
||||||
Run command will supervise the file system of the beego project using inotify,
|
Run command will supervise the file system of the beego project using inotify,
|
||||||
@ -43,12 +43,16 @@ var gendoc docValue
|
|||||||
// The flags list of the paths excluded from watching
|
// The flags list of the paths excluded from watching
|
||||||
var excludedPaths strFlags
|
var excludedPaths strFlags
|
||||||
|
|
||||||
|
// Pass through to -tags arg of "go build"
|
||||||
|
var buildTags string
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
cmdRun.Run = runApp
|
cmdRun.Run = runApp
|
||||||
cmdRun.Flag.Var(&mainFiles, "main", "specify main go files")
|
cmdRun.Flag.Var(&mainFiles, "main", "specify main go files")
|
||||||
cmdRun.Flag.Var(&gendoc, "gendoc", "auto generate the docs")
|
cmdRun.Flag.Var(&gendoc, "gendoc", "auto generate the docs")
|
||||||
cmdRun.Flag.Var(&downdoc, "downdoc", "auto download swagger file when not exist")
|
cmdRun.Flag.Var(&downdoc, "downdoc", "auto download swagger file when not exist")
|
||||||
cmdRun.Flag.Var(&excludedPaths, "e", "Excluded paths[].")
|
cmdRun.Flag.Var(&excludedPaths, "e", "Excluded paths[].")
|
||||||
|
cmdRun.Flag.StringVar(&buildTags, "tags", "", "Build tags (https://golang.org/pkg/go/build/)")
|
||||||
}
|
}
|
||||||
|
|
||||||
var appname string
|
var appname string
|
||||||
|
3
watch.go
3
watch.go
@ -170,6 +170,9 @@ func Autobuild(files []string, isgenerate bool) {
|
|||||||
|
|
||||||
args := []string{"build"}
|
args := []string{"build"}
|
||||||
args = append(args, "-o", appName)
|
args = append(args, "-o", appName)
|
||||||
|
if buildTags != "" {
|
||||||
|
args = append(args, "-tags", buildTags)
|
||||||
|
}
|
||||||
args = append(args, files...)
|
args = append(args, files...)
|
||||||
|
|
||||||
bcmd := exec.Command(cmdName, args...)
|
bcmd := exec.Command(cmdName, args...)
|
||||||
|
Loading…
Reference in New Issue
Block a user