1
0
mirror of https://github.com/beego/bee.git synced 2025-06-11 23:50:38 +00:00

1. new,api,hprose 命令增加两个参数 [-module=true] [-beego=v1.12.1] 用于生成go module项目

2. generate,migrate命令不再打印GOPATH.
3. pack命令排除。
4. run命令支持传递ldflags参数
5. fix watch file bug.ignoredFilesRegExps数组对每个文件增加$,防止目录存在tmp的情况
6. getPackagePath函数被调用时如果找不到GOPATH,则看看工程有没有go.mod 有就当做go module项目处理。
7. .travis.yml检查时排除/pkg/mod/目录
This commit is contained in:
qiantao
2020-06-25 22:29:27 +08:00
parent 1334a99810
commit 9433a7b66f
13 changed files with 237 additions and 72 deletions

View File

@ -40,6 +40,7 @@ var CmdPack = &commands.Command{
var (
appPath string
appName string
excludeP string
excludeS string
outputP string
@ -57,6 +58,7 @@ func init() {
fs := flag.NewFlagSet("pack", flag.ContinueOnError)
fs.StringVar(&appPath, "p", "", "Set the application path. Defaults to the current path.")
fs.BoolVar(&build, "b", true, "Tell the command to do a build for the current platform. Defaults to true.")
fs.StringVar(&appName, "a", "", "Set the application name. Defaults to the dir name.")
fs.StringVar(&buildArgs, "ba", "", "Specify additional args for Go build.")
fs.Var(&buildEnvs, "be", "Specify additional env variables for Go build. e.g. GOARCH=arm.")
fs.StringVar(&outputP, "o", "", "Set the compressed file output path. Defaults to the current path.")
@ -445,7 +447,9 @@ func packApp(cmd *commands.Command, args []string) int {
beeLogger.Log.Infof("Packaging application on '%s'...", thePath)
appName := path.Base(thePath)
if len(appName) == 0 {
appName = path.Base(thePath)
}
goos := runtime.GOOS
if v, found := syscall.Getenv("GOOS"); found {
@ -470,7 +474,7 @@ func packApp(cmd *commands.Command, args []string) int {
}()
if build {
beeLogger.Log.Info("Building application...")
beeLogger.Log.Infof("Building application (%v)...", appName)
var envs []string
for _, env := range buildEnvs {
parts := strings.SplitN(env, "=", 2)
@ -553,7 +557,8 @@ func packApp(cmd *commands.Command, args []string) int {
exs = append(exs, p)
}
}
exs = append(exs, `go.mod`)
exs = append(exs, `go.sum`)
var exr []*regexp.Regexp
for _, r := range excludeR {
if len(r) > 0 {