1. 在ubuntu上安装go.
在ubuntu14.04上目前,最高的版本是golang-1.6
$ sudo apt-get install golang-1.6
$ sudo apt-get install golang-go
然后参考
http://tecadmin.net/install-go-on-ubuntu/
环境变量设置参看 http://www.cnblogs.com/shaohef/p/6394950.html
安装完之后,
启动 $ godoc -http=:6060
可以查看各种库的帮助。
也可以在线参考go的各种库 : Document , pkg
2. go 学习
Go语言圣经(中文版) The author Brian W. Kernighan is also write the 大名鼎鼎的 <The C Programming Lanuaguage>
3.go-restful 非常好用 轻量级 推荐用
需要下载这个两个库。
https://github.com/emicklei/go-restful
https://github.com/go-swagger/go-swagger
这里有个中文分析:
http://blog.csdn.net/screscent/article/details/50923107
K8S就是用了这个框架
http://www.cnblogs.com/chris-cp/p/6108821.html
3. go 调用C
${SRCDIR} 目前实验的没起作用。
cgo: https://golang.org/cmd/cgo/
example: https://github.com/chai2010/bzip2need a wrap for c function, here is an example
cgo 似乎可以调用动态库: 动态库有个全局偏移表(Global Offset Table,GOT)
4. authorization
几个常见的rbac的lib
- casbin - Authorization library that supports access control models like ACL, RBAC, ABAC.
- gorbac - provides a lightweight role-based access control (RBAC) implementation in Golang.
- ladon A SDK for access control policies: authorization for the microservice and IoT age. Inspired by AWS IAM policies. Written for Go.