Closed wohenbushuang closed 3 years ago
@wohenbushuang 设计如此吧。不给定编译文件路径则会使用默认的go build
命令编译。
@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.
...
@wohenbushuang 当不给定os
和arch
时会和go build
一样生成可执行文件在当前目录,path
会失去作用,但是output
可以。
gf run
的时候会生成到config
文件中path
下,不过用gf build
编译时会生成在main.go
文件夹,path
设定被忽略