《Golang 的经验分享及建议》由会员分享,可在线阅读,更多相关《Golang 的经验分享及建议(10页珍藏版)》请在金锄头文库上搜索。
1、Golang分享 Beego Redigo Ffjson Beego/orm 其它Golang服务用到的模块 官方文档 https:/beego.me/docs/intro/beego https:/ https:/beego.me/docs/module/cache.md APRedigo(JimDB) encoding/json https:/golang.org/pkg/encoding/json/ 通过反射实现,性能不好 Ffjson https:/ MarshalJSON()、UnmarshalJSON() 通过重写函数实现 ffjson myfile.goffjson 驱动 自
2、动生成json结构定义 https:/ Bee https:/ bee generate appcode -tables=user_roles - driver=mysql - conn=“root:qwertytcp(192.168.33.10:3306)/plist_ad min?charset=utf8“ -level=1 bee help generate其它 https:/golang.org/pkg/testing/ https:/ golang/blob/master/zh/11.3.md go test -coverprofile=c.out & go tool cover -html=c.outtest常见问题 GC。不只是STW,还有内存分配性能问题。数据结 构优化,对象池。 程序异常退出。常规beego会捕获;自己起的协程需 要加defer捕获异常。 内存占满。debug.FreeOSMemory() GODEBUG=gctrace=1 可以看见内存使用情况、对象 数,GC各个阶段情况 JimDB AP挂了。手动刷新连接池。 消息量大。使用一个队列接受消息。 论坛 https:/gocn.io/ 进阶 https:/ Gopher china 2016 视频 http:/ Gopher china 2015 视频 http:/ 文档 godoc.org资料