golang
Scathon
追梦之猿
展开
-
Golang常用工具类库
Go语言常用功能类库 Welcome! github地址如下,欢迎star fork commit. 代码传送门,快点击我 功能列表: 数据结构(collections/***) map 链式map(linkedhashmap: collections/map2/linkedhashmap.go) queue 优先级队列(collections/queue/priority_queue.go) set set(collections/set/set.go) 文件操作(utils/f原创 2020-12-12 20:30:07 · 2086 阅读 · 0 评论 -
Golang解决TCP粘包拆包问题
协议定义 报文长度(4字节) 报文内容[]byte 服务端代码 package main import ( "encoding/binary" "fmt" "net" ) func main() { fmt.Println("Starting the server ...") // 创建 listener listener, err := net.Listen("tcp", "localhost:50000") if err != nil { fmt.Println("E原创 2020-08-09 16:23:57 · 989 阅读 · 6 评论 -
golang杂记
对于golang,我是拾起来,又放下,拾起来,又放下。。。。。。 字符串部分 字符串中含有中文的时候,遍历乱码解决办法: func TestStringWithChinese(t *testing.T) { s := "hello,林某人" bytes := []byte(s) fmt.Println(string(bytes)) for _, ch := range s { ...原创 2019-12-08 22:37:16 · 128 阅读 · 0 评论