
go语言
大笑。
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Go语言学习:从文件格式化读写
遇到的问题:md5哈希得到的值是16字节的值,是无法与字符编码对应的,使用ioutil.writefile写到文件里出现得到的文件是乱码的问题。 原因:ioutil.writefile默认[]byte数组是以utf-8编码的字符数组。 go语言默认utf-8编码,string类型转[]byte类型:“abc黄” →616263e9bb84(61即97,黄占三个字节) 测试:ioutil.Readf...原创 2020-04-19 00:16:02 · 639 阅读 · 0 评论 -
通过golang context实现请求超时控制和goroutine生命周期控制
原文链接:https://blog.youkuaiyun.com/qq180782842/article/details/88942602 通过golang context实现请求超时控制和goroutine生命周期控制 下例中:lazyHander负责请求参数处理和context的初始化: 客户端发送超时参数,采用WithTimeout来控制context在指定时间内关闭其管道,若所有子进程中均声明了正确的...转载 2020-04-06 23:27:31 · 1117 阅读 · 0 评论 -
golang context包
Context是接口,实现的方法: Deadline() (deadline time.Time, ok bool) Done() <-chan struct{} Err() error Value(key interface{}) interface{} Value() returns the value associated with this context for key, or n...原创 2020-03-15 00:45:30 · 92 阅读 · 0 评论