golang
Scathon
追梦之猿
展开
-
Golang常用工具类库
Go语言常用功能类库Welcome! github地址如下,欢迎star fork commit.代码传送门,快点击我功能列表:数据结构(collections/***)map链式map(linkedhashmap: collections/map2/linkedhashmap.go)queue优先级队列(collections/queue/priority_queue.go)setset(collections/set/set.go)文件操作(utils/f原创 2020-12-12 20:30:07 · 2156 阅读 · 0 评论 -
Golang解决TCP粘包拆包问题
协议定义报文长度(4字节)报文内容[]byte服务端代码package mainimport ( "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 · 1079 阅读 · 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 · 140 阅读 · 0 评论