go-zero环境安装
安装goctl go install github.com/zeromicro/go-zero/tools/goctl@latest 安装protoc goctl env check --i
go-zero环境安装
发布时间:2023-10-27 (2023-10-27)

安装goctl

go install github.com/zeromicro/go-zero/tools/goctl@latest

安装protoc

goctl env check --install --verbose --force
go get -u github.com/zeromicro/go-zero@latest

goland安装goctl插件

快速创建一个api服务

goctl api new api

然后修改一下user/api/internal/logic/apilogic.go文件

func (l *ApiLogic) Api(req *types.Request) (resp *types.Response, err error) {
  // todo: add your logic here and delete this line

  return &types.Response{Message: "枫枫"}, nil
}

快速创建一个rpc服务

goctl rpc new rpc

然后在user的api目录运行

go run api.go

访问 127.0.0.1:8888/from/me 能看到数据就说明环境安装好了

参考文档

环境搭建 https://blog.csdn.net/xwh3165037789/article/details/131577365

官方文档 https://go-zero.dev/docs/tasks/installation/goctl