blog icon indicating copy to clipboard operation
blog copied to clipboard

极客兔兔的博客,Coding Coding 创建有趣的开源项目。

Results 103 blog issues
Sort by recently updated
recently updated
newest added

https://geektutu.com/post/quick-gomock.html gomock 是Go语言/golang 官方提供的mock库,用于在单元测试(unit tests) 中模拟一些依赖复杂,难以直接调用的场景,比如网络请求、数据库依赖和文件I/O等。本文介绍了 gomock 的使用方法,包括模拟参数(Any, Nil, Not, Eq)和返回值(Do, Return, DoAndReturn),以及调用次数(Times) 和顺序(InOrder),如何写可测试可mock的代码。

Gitalk
/post/quick-gomock.html

https://geektutu.com/post/gee-day6.html 7天用 Go语言 从零实现Web框架教程(7 days implement golang web framework from scratch tutorial),用 Go语言/golang 动手写Web框架,从零实现一个Web框架,以 Gin 为原型从零设计一个Web框架。本文介绍了如何为Web框架添加HTML模板(HTML Template)以及静态文件(Serve Static Files)的功能。

Gitalk
/post/gee-day6.html

https://geektutu.com/post/geecache-day2.html 7天用 Go语言/golang 从零实现分布式缓存 GeeCache 教程(7 days implement golang distributed cache from scratch tutorial),动手写分布式缓存,参照 groupcache 的实现。本文介绍了 sync.Mutex 互斥锁的使用,并发控制 LRU 缓存。实现 GeeCache 核心数据结构 Group,缓存不存在时,调用回调函数(callback)获取源数据。

Gitalk
/post/geecache-day2.html

https://geektutu.com/post/gee-day5.html 7天用 Go语言 从零实现Web框架教程(7 days implement golang web framework from scratch tutorial),用 Go语言/golang 动手写Web框架,从零实现一个Web框架,以 Gin 为原型从零设计一个Web框架。本文介绍了如何为Web框架添加中间件的功能(middlewares)。

Gitalk
/post/gee-day5.html

https://geektutu.com/post/geecache-day6.html 7天用 Go语言/golang 从零实现分布式缓存 GeeCache 教程(7 days implement golang distributed cache from scratch tutorial),动手写分布式缓存,参照 groupcache 的实现。本文介绍了缓存雪崩、缓存击穿与缓存穿透的概念,使用 singleflight 防止缓存击穿,实现与测试。

Gitalk
/post/geecache-day6.html

https://geektutu.com/post/geerpc-day6.html 7天用 Go语言/golang 从零实现 RPC 框架 GeeRPC 教程(7 days implement golang remote procedure call framework from scratch tutorial),动手写 RPC 框架,参照 golang 标准库 net/rpc 的实现,实现了服务端(server)、支持异步和并发的客户端(client)、消息编码与解码(message encoding and decoding)、服务注册(service register)、支持 TCP/Unix/HTTP 等多种传输协议。第六天实现了2种简单的负载均衡(load...

Gitalk
/post/geerpc-day6.html

https://geektutu.com/post/geecache-day5.html 7天用 Go语言/golang 从零实现分布式缓存 GeeCache 教程(7 days implement golang distributed cache from scratch tutorial),动手写分布式缓存,参照 groupcache 的实现。本文介绍了为 GeeCache 添加了注册节点与选择节点的功能,并实现了 HTTP 客户端,与远程节点的服务端通信。

Gitalk
/post/geecache-day5.html

https://geektutu.com/post/hpg-concurrency-control.html Go 语言/golang 高性能编程,Go 语言进阶教程,Go 语言高性能编程(high performance go)。本文介绍了 goroutine 协程并发控制,避免并发过高,大量消耗系统资源,导致程序崩溃或卡顿,影响性能。主要通过 2 种方式控制,一是使用 channel 的缓冲区,二是使用第三方协程池,例如 tunny 和 ants。同时介绍了使用 ulimit 和虚拟内存(virtual memory)提高资源上限的技巧。

Gitalk
/post/hpg-concurrency-control.html

https://geektutu.com/post/hpg-exit-goroutine.html Go 语言/golang 高性能编程,Go 语言进阶教程,Go 语言高性能编程(high performance go)。本文介绍了协程没有正常关闭导致内存泄漏的场景,并介绍了如何借助通道/信道(channel) 优雅地退出协程。

Gitalk
/post/hpg-exit-goroutine.html

https://geektutu.com/post/geeorm-day1.html 7天用 Go语言/golang 从零实现 ORM 框架 GeeORM 教程(7 days implement golang object relational mapping framework from scratch tutorial),动手写 ORM 框架,参照 gorm, xorm 的实现。介绍了 SQLite 的基础操作(连接数据库,创建表、增删记录等),使用 Go 标准库 database/sql 操作 SQLite...

Gitalk
/post/geeorm-day1.html