随笔分类 -  踩坑之路

摘要:记一次线上事故排查 具体场景简介: 目前有一个数据同步的场景(Mongodb → ES) 架构模型如下: 遇到的问题: 任务消费到某一时刻,就会hang住,无法继续消费,channel队列满了以后,导致整个同步任务全面停止 可以很明显的看到已经hang住了,并且最后一条日志明确的显示是阻塞在发送任务 阅读全文
posted @ 2022-02-21 16:46 Binb 阅读(399) 评论(0) 推荐(0) 编辑
摘要:body, _ := c.GetRawData() // 获取原body数据 // 将原body塞回去 c.Request.Body = ioutil.NopCloser(bytes.NewBuffer(body)) 阅读全文
posted @ 2021-08-10 12:37 Binb 阅读(231) 评论(0) 推荐(0) 编辑
摘要:option 选项模式已经很常见了 这里不再赘述 → 场景: 比如一个函数 需要一个当前时间 又想测试的时候控制传入的当前时间 func Demo(t ...time.Time) { // 如果不传入参数就使用当前时间 // 如果传入就是用传入时间 tt := append(t, time.Now( 阅读全文
posted @ 2021-06-07 17:45 Binb 阅读(195) 评论(0) 推荐(0) 编辑
摘要:检查是否 xxx.proto文件设置 option 导出路径属性 option go_package = "./;errors"; 加上即可 阅读全文
posted @ 2021-06-04 14:45 Binb 阅读(2568) 评论(0) 推荐(0) 编辑
摘要:有趣的代码片段 自重写程序 UNIX/Go语言之父 Ken Thompson 在1983年的图灵奖演讲 Reflections on Trusting Trust 就给出了一个C语言的自重写程序。 最短的C语言自重写程序是 Vlad Taeerov 和 Rashit Fakhreyev 的版本: m 阅读全文
posted @ 2020-06-09 19:04 Binb 阅读(364) 评论(0) 推荐(0) 编辑
摘要:Go语言常见坑 可变参数是空接口类型 当参数的可变参数是空接口类型时,传入空接口的切片时需要注意参数展开的问题。 func main() { var a = []interface{}{1, 2, 3} fmt.Println(a) fmt.Println(a...) } 不管是否展开,编译器都无法 阅读全文
posted @ 2020-06-09 18:52 Binb 阅读(454) 评论(0) 推荐(0) 编辑
摘要:解决步骤: 1:先在IDE访问google/protobuf/descriptor.proto将其copy 2:创建类似结构 -gopath -src -google -protobuf -descriptor.proto 3.将copy的文件赋值到descriptor.proto中(或不需要创建直 阅读全文
posted @ 2020-06-07 17:44 Binb 阅读(15141) 评论(1) 推荐(1) 编辑
摘要:大家都知道slice是一个引用类型,废话不多说,上代码 func test(res [][]int) { res[0] = []int{2,2,2,2} res[1][0] = 3 } func main() { res := [][]int{[]int{1,1,1,1},[]int{2,2,2,2 阅读全文
posted @ 2020-05-10 10:51 Binb 阅读(346) 评论(0) 推荐(0) 编辑
摘要:检查是否重复引用 阅读全文
posted @ 2020-03-13 20:52 Binb 阅读(330) 评论(0) 推荐(0) 编辑
摘要:package main import ( "fmt" ) func main() { // 字符串 str := "ABCDEFGHIJKLMNOPQRSTUVWXYZ" // 直接使用string强转 例如 string(65) = A fmt.Println(fmt.Sprint(string 阅读全文
posted @ 2020-01-10 21:25 Binb 阅读(151) 评论(0) 推荐(0) 编辑
摘要:关闭Rootless 进入恢复模式(重启系统时按住command+R进入恢复模式)下打开终端; 关闭系统SIP保护:csrutil disable; 重启,进入正常系统; 解决无法添加VMware辅助功能的问题 进入系统后打开终端; 依次输入以下命令: $ sudo chmod 777 /Libra 阅读全文
posted @ 2019-12-25 23:43 Binb 阅读(2089) 评论(0) 推荐(0) 编辑
摘要:文章引用自 解决go get下载包失败问题 从github克隆 golang在github上建立了一个镜像库,如https://github.com/golang/net就对应是 https://golang.org/x/net的镜像库。 要下载golang.org/x/net包,可以在本地创建包的 阅读全文
posted @ 2019-12-12 15:23 Binb 阅读(364) 评论(0) 推荐(0) 编辑
摘要:在使用goland使用debug调试代码出现 API server listening at: 127.0.0.1:56871could not launch process: debugserver or lldb-server not found: install XCode's command 阅读全文
posted @ 2019-11-18 17:16 Binb 阅读(2231) 评论(0) 推荐(0) 编辑
摘要:PS:部分因更新OS X导致的卡99%可以尝试更新VBOX来解决此问题。 下载VBOX地址:https://www.virtualbox.org/wiki/Downloads 选择对应的平台 下载 重新安装 阅读全文
posted @ 2019-11-12 18:55 Binb 阅读(2494) 评论(0) 推荐(0) 编辑
摘要:在Pycharm IDE下 Edit Configurations 1.检查Python interpreter 2.检查 Working directory 3.Settings 数据库配置 阅读全文
posted @ 2019-10-30 14:16 Binb 阅读(479) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示