Go
gvm管理go版本
·18 字
使用gvm管理Go版本 moovweb/gvm Go Version Manager Shell 10552 558
Go语言技巧
·693 字
Defer两阶段延迟执行 # 记录函数执行时间 package main import ( "log" "time" ) func main()
Go序列化与反序列化thrift数据
·319 字
thrift IDL文件定义 # foo.thrift namespace go foo struct Bar { 1: optional string name; } 生成go文件 thrift -gen go
使用lumberjack对gorm日志进行分割
·112 字
示例demo # package mysql import ( "log" "github.com/natefinch/lumberjack" "gorm.io/driver/mysql" "gorm.io/gorm" "gorm.io/gorm/logger" ) func InitMySQL() { gormConf := &gorm.Config{ Logger: getLogger(), QueryFields: true, } dsn :=
pprof分析
·606 字
服务增加 pprof 监控 # package main import( "net/http" _ "net/http/pprof" ) func main() { go func() { log.Println(http.ListenAndServe("localhost:6060", nil)) }() // do something } pprof 包
Sort
·1383 字
Functions # Find()-查找元素 # 该方法基于二分查找,需要被查找对
Go包管理
·1727 字
GOPATH # Go 1.8 版本之前 GOPATH 默认是空的,1.8 版本之后会默认为 GOPATH 设置一
获取图片信息
·360 字
获取远程图片信息 # image库针对远程图片使用image.D
Sentinel Golang
·1702 字
限流规则 # // Strategy type TokenCalculateStrategy int32 const ( Direct TokenCalculateStrategy = iota WarmUp MemoryAdaptive ) // Rule describes the strategy of flow control, the flow control
链表
·358 字
链表简述 # 链表(Linked list)是一种常见的基础数据结