gf build时path被忽略
wohenbushuang opened this issue · 3 comments
wohenbushuang commented
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
@wohenbushuang 设计如此吧。不给定编译文件路径则会使用默认的go build
命令编译。
wohenbushuang commented
@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
@wohenbushuang 当不给定os
和arch
时会和go build
一样生成可执行文件在当前目录,path
会失去作用,但是output
可以。