10 2022 档案
摘要:1、kitex的支持的编解码协议 (1)目前,Kitex 支持了 thrift 和 protobuf 两种编解码协议。 (2)thrift编解码 生成代码时可以不指定 thrift 协议,默认就是 thrift。 //生成客户端代码 kitex -type thrift ${service_name
阅读全文
摘要:1、安装依赖 安装 kitex和thriftgo go install github.com/cloudwego/kitex/tool/cmd/kitex@latest go install github.com/cloudwego/thriftgo@latest 2、相关概念 (1)Kitex
阅读全文
摘要:1、linux系统安装kitex工具还是报错command not found // 找到etc/profile文件,输入如下(path是kitex的安装目录) export PATH=$PATH:/root/goCode/bin // 更新配置 source /etc/profile 参考:(36
阅读全文
摘要:参考:linux 安装consul - 简书 (jianshu.com)
阅读全文
摘要:1、信号传递 有 4 个 goroutine,编号为 1、2、3、4。每秒钟会有一个 goroutine 打印出它自己的编号,要求你编写程序,让输出的编号总是按照 1、2、3、4、1、2、3、4……这个顺序打印出来。 type Token struct{} func newWorker(id int
阅读全文
摘要:1、golang的持久化连接 在Golang中使用持久化连接发起HTTP请求,主要依赖Transport,官方封装的net库中已经支持。 Transport实现了RoundTripper接口,该接口只有一个方法RoundTrip(),故Transport的入口函数就是RoundTrip()。 Tra
阅读全文