cockroachdb / cockroachdb/errors

Decode context.Canceled, context.DeadlineExceeded etc as a reference to the stdlib instance

未关闭
#87 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Go
星标
2.5k
派生
74
PR 合并指标
30 天内没有已合并 PR

描述

Currently, instances of the stdlib errors trasnferred over the network are decoded into an object of the same type/value, but not the same instance. So reference comparisons with `==` with the stdlib instance fail.

This matters for e.g. `context.Context.Err()` which describes in its API doc that it returns the standrd errors _unwrapped_ so it's legitimate for a caller to use `==`.

We could address that by adding a special case in the leaf decoder, so that if a leaf is one of the known stdlib errors, we return the stdlib instance instead.

贡献指南

这个仓库没有索引到贡献指南

调研方向

首先阅读 issue 中提到的 leaf decoder,并跟踪通过网络传输的标准库错误是如何被重建的。检查 context.Canceled 和 context.DeadlineExceeded 的表示方式,然后验证解码返回的是标准库实例,从而使与 == 的比较能够成功。

由索引模型根据 Issue 内容生成。

评估

技术栈
go
领域
distributed-systems
Issue 类型
功能
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。