goctl常用命令
goctl常用命令
help
goctl api--help输出如下
Generate api related files Usage: goctl api [flags] goctl api [command] Available Commands: dart Generate dart files for provided api in api file doc Generate doc files format Format api files go Generate go files for provided api in api file kt Generate kotlin code for provided api file new Fast create api service plugin Custom file generator swagger Generate swagger file from api ts Generate ts files for provided api in api file validate Validate api file Flags: --branch string The branch of the remote repo, it does work with --remote -h, --help help for api --home string The goctl home path of the template, --home and --remote cannot be set at the same time, if they are, --remote has higher priority --o string Output a sample api file --remote string The remote git repo of the template, --home and --remote cannot be set at the same time, if they are, --remote has higher priority The git repo directory must be consistent with the https://github.com/zeromicro/go-zero-template directory structure Use "goctl api [command] --help" for more information about a command.goctl api new 快速创建api服务(切记)
goctl api new firstdemogoctl api format 格式化api文件
goctl apiformat--dir.goctl api go 为api文件生成go代码(切记)
goctl api go--apifirstdemo.api--dir.goctl api doc生成doc文档
goctl api doc--dir.--o./docgoctl api dart/goctl api ts 生成调用文件
goctl api dart和goctl api ts命令主要用于根据你定义的api文件,自动生成客户端请求代码,这样能显著提升前端或者客户端与你的go-zero后端联调的效率
goctl api dart--apifirstdemo.api--dir./dartgoctl api ts--apifirstdemo.api--dir./tsgoctl api swagger
为go-zero定义的api文件生成swagger文档
goctl api swagger--apifirstdemo.api--dir./doc--filenamefirstdemogo常用命令
go env查看go的环境变量
其中gopath是go插件的安装目录
goenv安装fresh实现热加载
# 使用这个可以热加载goinstallgithub.com/gravityblast/fresh@latest# 使用安装fresh