goland下tarsgo使用mod模式开发

tarsgo官方下载小例子:

https://github.com/TarsCloud/TarsGo

使用goland打开其中一个小例子,大体结构如下图所示:

第一步:开启go modules,并设置Proxy

第二步:初始化go mod

go mod init test


第三步:安装TarsGo

go get github.com/TarsCloud/TarsGo/tars


第四步:编译tars协议转Golang工具

go install github.com/TarsCloud/TarsGo/tars/tools/tars2go

第五步:编译tars文件并转成go文

#有两个tars文件,所以都要转换一下
tars2go --outdir=./vendor EchoClient.tars
tars2go --outdir=./vendor EchoTest.tars

第六步:作为服务端,引用并实现EchoTest.tars

猜你喜欢

转载自www.cnblogs.com/cnlihao/p/12751066.html
今日推荐