【后端开发】字节跳动青训营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

最后得到如下结果:

相关推荐
讲不出 再见7 小时前
go语言-指针
go·指针
讲不出 再见16 小时前
go语言-包
golang·go·package··包冲突
王中阳Go2 天前
用Go写AI Agent:我从实战图书里总结了这些核心逻辑
后端·go·ai编程
扉页的墨3 天前
Go 错误处理之道:别再到处 return fmt.Errorf 了,你的代码正在失控
go
止语Lab3 天前
你写的Go代码,编译器能"看懂"多少
go
刀法如飞4 天前
Go数组去重的20种实现方式,AI时代解决问题的不同思路
后端·算法·go
AI编程探险者5 天前
Go 编译的二进制突然跑不起来了?凶手是 macOS 的 syspolicyd
go
用户398346161205 天前
10 个示例快速入门 Go-Spring|v1.3.0 正式发布
go
zhouwy1136 天前
Golang 基础与实战笔记:从语法到微服务的全面指南
开发语言·go
日火7 天前
Go:实现基于mutex的环形缓冲区
go