代码拉取完成,页面将自动刷新
同步操作将从 goflyfox/gfstudy 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
go.mod
module gfcli
go 1.13
获取包
$ gf get github.com/gogf/gf
go: github.com/gogf/gf upgrade => v1.12.2
go.mod
module gfcli
require github.com/gogf/gf v1.12.2 // indirect
go 1.13
$ gf pack -h
USAGE
gf pack SRC DST
ARGUMENT
SRC source path for packing, which can be multiple source paths.
DST destination file path for packed file. if extension of the filename is ".go" and "-n" option is given,
it enables packing SRC to go file, or else it packs SRC into a binary file.
OPTION
-n, --name package name for output go file
-p, --prefix prefix for each file packed into the resource file
EXAMPLES
gf pack public data.bin
gf pack public,template data.bin
gf pack public,template boot/data.go -n=boot
gf pack public,template,config resource/resource.go -n=resource
gf pack public,template,config resource/resource.go -n=resource -p=/var/www/my-app
gf pack /var/www/public resource/resource.go -n=resource
$ gf pack config,public,template boot/data.go -n boot
done!
生成文件data.go,内容省略
package boot
import "github.com/gogf/gf/os/gres"
func init() {
if err := gres.Add("1f8b0800000000000"); err != nil {
panic(err)
}
}
通过gres.Dump()打印
2020-04-28T17:06:23+00:00 0.00B config
2020-04-28T16:13:03+00:00 0.00B config/.gitkeep
2020-04-28T16:35:35+00:00 578.00B config/config.toml
2020-04-28T17:06:23+00:00 0.00B public
2020-04-28T16:13:03+00:00 0.00B public/html
2020-04-28T16:13:03+00:00 0.00B public/html/.gitkeep
2020-04-28T16:13:03+00:00 0.00B public/plugin
2020-04-28T16:13:03+00:00 0.00B public/plugin/.gitkeep
2020-04-28T16:13:03+00:00 0.00B public/resource
2020-04-28T16:13:03+00:00 0.00B public/resource/css
2020-04-28T16:13:03+00:00 0.00B public/resource/css/.gitkeep
2020-04-28T16:13:03+00:00 0.00B public/resource/image
2020-04-28T16:13:03+00:00 0.00B public/resource/image/.gitkeep
2020-04-28T16:13:03+00:00 0.00B public/resource/js
2020-04-28T16:13:03+00:00 0.00B public/resource/js/.gitkeep
2020-04-28T17:06:23+00:00 0.00B template
2020-04-28T16:13:03+00:00 0.00B template/.gitkeep
$ gf docker -h
USAGE
gf docker [FILE] [OPTION]
ARGUMENT
FILE file path for "gf build", it's "main.go" in default.
OPTION the same options as "docker build" except some options as follows defined
OPTION
-p, --push auto push the docker image to docker registry if "-t" option passed
EXAMPLES
gf docker
gf docker -t hub.docker.com/john/image:tag
gf docker -p -t hub.docker.com/john/image:tag
gf docker main.go
gf docker main.go -t hub.docker.com/john/image:tag
gf docker main.go -t hub.docker.com/john/image:tag
gf docker main.go -p -t hub.docker.com/john/image:tag
DESCRIPTION
The "docker" command builds the GF project to a docker images. It runs "docker build"
command automatically, so you should have docker command first.
There must be a Dockerfile in the root of the project.
$gf docker main.go -p -t 10.130.44.133/test/gfcli:v1.0.0
2020-04-29 00:57:54.378 start building...
2020-04-29 00:57:54.379 go build -o ./bin/linux_amd64/main main.go
2020-04-29 00:57:55.849 done!
2020-04-29 00:57:55.943 docker build .
2020-04-29 00:57:56.831 docker push 10.130.44.133/test/gfcli:v1.0.0
$ gf swagger -h
USAGE
gf swagger [OPTION]
OPTION
-s, --server start a swagger server at specified address after swagger files
produced
-o, --output the output directory for storage parsed swagger files,
the default output directory is "./swagger"
-/--pack auto parses and packs swagger into boot/data-swagger.go.
EXAMPLES
gf swagger
gf swagger --pack
gf swagger -s 8080
gf swagger -s 127.0.0.1:8080
gf swagger -o ./document/swagger
DESCRIPTION
The "swagger" command parses the current project and produces swagger API description
files, which can be used in swagger API server. If used with "-s/--server" option, it
watches the changes of go files of current project and reproduces the swagger files,
which is quite convenient for local API development.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。