【后端开发】字节跳动青训营Cloudwego脚手架

Cloudwego脚手架使用

cwgo脚手架

  1. 安装的命令:
bash 复制代码
GOPROXY=https://goproxy.cn/,direct go install github.com/cloudwego/cwgo@latest
  1. 依赖thriftgo的安装:
bash 复制代码
go install github.com/cloudwego/thriftgo@latest
  1. 编辑echo.thrift文件用于生成项目:
powershell 复制代码
namespace go api

struct Request {
    1: string message
}

struct Response {
    1: string message //注意这里前面的是数字1不是字母l
}

service Echo {
    Response echo(1: Request req)
}
  1. 在demo/demo_thrift目录下生成代码:
bash 复制代码
cwgo server --type RPC --module github.com/cloudwego/biz-demo/gomall/demo/demo_thrift --service demo_thrift --idl ../../idl/echo.thrift

最后得到如下结果:

相关推荐
yuadsl301011 小时前
heyicache--性能极限版的freecache
go
Code季风11 小时前
从超卖到数据一致:分布式锁的最佳实践与演进历程
分布式·微服务·go
程序员爱钓鱼12 小时前
Go语言实战案例:使用channel实现生产者消费者模型
后端·go·trae
程序员爱钓鱼12 小时前
Go语言实战案例:使用select监听多个channel
后端·go·trae
亿刀1 天前
【go语言基础】slice
go
五岁小孩吖1 天前
Go 单元测试 testing 包详解(testing.T、M、B、PB)
go
楽码1 天前
一文看懂GO新版映射实现SwissTable
后端·算法·go
Code季风1 天前
什么是微服务分布式配置中心?
分布式·微服务·go
Code季风1 天前
微服务配置治理实战:Gin 与 gRPC 服务集成 Nacos 全解析
分布式·微服务·go