gogf / gf-cli

GoFrame Command Line Interface, which is your helpmate for building GoFrame application with convenience.
https://goframe.org
MIT License
255 stars 106 forks source link

gf build时path被忽略 #107

Closed wohenbushuang closed 3 years ago

wohenbushuang commented 3 years ago

gf run的时候会生成到config文件中path下,不过用gf build编译时会生成在main.go文件夹,path设定被忽略

# config.toml
[gfcli]
    [gfcli.build]
        path   = "./bin"
>gf build
2021-08-01 01:26:52.585 start building...
2021-08-01 01:26:52.585 go build -o main.exe main.go
2021-08-01 01:26:55.712 done!

>gf run main.go
2021-08-01 01:27:27.120 build: main.go
2021-08-01 01:27:27.130 go build -o bin\main.exe  main.go
2021-08-01 01:27:40.571 bin\main.exe
...
gqcn commented 3 years ago

@wohenbushuang 设计如此吧。不给定编译文件路径则会使用默认的go build命令编译。

wohenbushuang commented 3 years ago

@gqcn 给定了编译文件路径也是一样的

>gf build main.go
2021-08-01 12:27:26.354 start building...
2021-08-01 12:27:26.354 go build -o main.exe main.go
2021-08-01 12:27:33.961 done!

应该是bug吧,因为gf build的help里也明确了-p, --path默认是./bin,但是确实直接被忽略了

>gf help build
USAGE
    gf build FILE [OPTION]

ARGUMENT
    FILE  building file path.

OPTION
    -n, --name       output binary name
    -v, --version    output binary version
    -a, --arch       output binary architecture, multiple arch separated with ','
    -s, --system     output binary system, multiple os separated with ','
    -o, --output     output binary path, used when building single binary file
    -p, --path       output binary directory path, default is './bin'                            <------
    -e, --extra      extra custom "go build" options
    -m, --mod        like "-mod" option of "go build", use "-m none" to disable go module
    -c, --cgo        enable or disable cgo feature, it's disabled in default
    --pack           pack specified folder into packed/data.go before building.
    --swagger        auto parse and pack swagger into packed/swagger.go before building.

...
gqcn commented 3 years ago

@wohenbushuang 当不给定osarch时会和go build一样生成可执行文件在当前目录,path会失去作用,但是output可以。