主要学习net/rpc和kite框架
流行的rpc框架性能测试对比 :kite 不是开源的 改学 thrift kit
go get github.com/PlagueCat-Miao/TheGoRpcLerarnNote
git clone https://github.com/PlagueCat-Miao/TheGoRpcLerarnNote.git
cd $GOPATH/src/github.com/PlagueCat-Miao/TheGoRpcLerarnNote;git pull origin master;git diff
git add .
git commit -m "XX"
git statue
git diff
git push origin master
git add . ; git commit -m "快捷上传"; git push origin master
cd $GOPATH/src/github.com/PlagueCat-Miao/TheGoRpcLerarnNote;git add . ;git commit -m "快速上传"; git push origin master
#### 用户名
PlagueCat-Miao
#### 自动输入密码
git config credential.helper store
MaC: Mac install Thrift
liunx:
sudo apt-get install automake bison flex g++ git libboost-all-dev libevent-dev libssl-dev libtool make pkg-config
# 下载安装包
http://archive.apache.org/dist/thrift/
http://www.apache.org/dyn/closer.cgi?path=/thrift/0.9.1/thrift-0.9.1.tar.gz
curl -# -O http://archive.apache.org/dist/thrift/0.9.2/thrift-0.9.2.tar.gz
wget http://archive.apache.org/dist/thrift/0.9.2/thrift-0.9.2.tar.gz
# 下载完成后开始解压
tar zxvf thrift-0.9.2.tar.gz
# 进入文件夹
cd thrift-0.9.2
# 初始化配置
./configure
# 开始构建
make
# 一定要用sudo,本机编译
sudo make install
# 查看thrift是否生效
thrift --version
# 显示:Thrift version 0.9.2
windows: Apache Thrift 在Windows下的安装与开发
Thrift RPC 使用指南实战(附golang&PHP代码) thrift go语言官方例子 git clone https://github.com/apache/thrift.git
git add . ; git commit -m "快捷上传"; git push origin master
使用 Go Modules(模块)进行依赖项迁移 开始使用依赖关系管理 若要转换已使用依赖关系管理工具的项目,请运行以下命令: go: creating new go.mod: module github.com/my/project go: copying requirements from Godeps/Godeps.json
replace 时如何输入版本号
- 可以输入 分支名 / tag / commit 号:一般他们为网页的最后一个尾缀;go get 的过程中会自动找到正确的版本编号,并更新 go.mod
- 输入master 如:
https://github.com/koding/kite- 就可以输入
xxxx => github.com/koding/kite master - go get 后go.mod更新为
github.com/koding/kite v0.0.0-20180710021347-baa1a54919e3
- 就可以输入
- 完整commit号 如:
https://github.com/koding/kite/commit/59a699eb5ebad76fecf2b375b4599650eaf936f3- 就可以输入
xxxx => github.com/koding/kite 59a699eb5ebad76fecf2b375b4599650eaf936f3 - go get 后go.mod更新为
github.com/koding/kite v0.0.0-20180710021347-baa1a54919e3
- 就可以输入
- 简码commit 如
- 就可以输入
xxxx => github.com/koding/kite baa1a54 - go get 后go.mod更新为
github.com/koding/kite v0.0.0-20180710021347-baa1a54919e3
- 就可以输入
- branch 如:
https://github.com/koding/kite/tree/fix-etcd-build- 就可以输入
xxxx => github.com/koding/kite fix-etcd-build - 也可以commit 简码
xxxx => github.com/koding/kite 59a699e - go get 后go.mod更新为
github.com/koding/kite v0.0.0-20150902091132-59a699eb5eba
- 就可以输入
- version 如
https://github.com/gorilla/websocket/releases/tag/v1.4.0
-
某些项目发布 vx 高级版本如:
https://github.com/igm/sockjs-go/tree/master/v3- 确定发布版本
- 存在vx文件夹,其下有独立的go.mod,且module含有vx如:
module github.com/igm/sockjs-go/v3 - or 项目打有标签/分支 如
v3其下go.mod的module含有vx,如:module github.com/igm/sockjs-go/v3 - 如果要 import
github.com/igm/sockjs-go/v3 - 如果要 replace(commit简码)
XXX => github.com/igm/sockjs-go/v3 50a6500注意这个页面的go.mod 应含有module github.com/igm/sockjs-go/v3如:
-
code.google.com/失败- 其中
p/go.net路径下 已被转移golang.org/x/net - 如
code.google.com/p/go.net/websocket- go.mod 不可改为
golang.org/x/net/websocket因为没有go.mod - go get
golang.org/x/net import 改为golang.org/x/net/websocket
- go.mod 不可改为
- 其中
-
参考网站 - go mod 使用旧版本 版本号指定 - go1.13 mod 实践和常见问题
对于某个项目,如果需要 replace 、require 只需要在此目录下的go.mod 设计。整个go build过程都生效,
- 当然你也可以去pkg 里去改。
- 当然你子项目GET不到,不会在主项目里更新require,但在主go.mod里replace生效
- //是注释 会因为
go mod tidy而被清除
你会得到所有分支 直接 git branch 转分支
- 一句话 官方大法好thrift 0.13.0
- 里面实例中
tutorialshared是gen-go下的路径
- 里面实例中
- thrift解析
