Context
已收录文章:3篇
-
Golang · Go问答 | 5天前 | go · Context · 并发编程 · 接口超时 · 超时控制 goroutine泄漏 WithTimeout Go context Go问答 CancelFunc从接口超时、下游取消和 goroutine 泄漏治理角度,解释 Go context 的使用价值、风险边界、采用路径和观察指标。477 收藏
-
Golang · Go教程 | 4天前 | channel · select · Context · Go教程 · 性能排查 · select channel context default time.Ticker Go教程 CPU飙高 for selectGo 里的 select default 适合做非阻塞试探,但放进无等待的 for 循环后,代码会在没有 channel 事件时持续空转,常见表现就是 CPU 飙高、日志刷屏和退出路径混乱。459 收藏
-
Golang · Go问答 | 4天前 | 中间件 · Context · Go问答 · 架构模式 · 代码边界 · 中间件 context Context.Value Go问答 WithValue 请求作用域 业务参数Go context 可以放用户 ID、traceID 这类请求作用域值,但不适合替代函数参数。本文用中间件、Service 和 Repository 的边界示例说明怎么判断。269 收藏