cockroachdb / cockroachdb/errors
Decode context.Canceled, context.DeadlineExceeded etc as a reference to the stdlib instance
- Dominant language
- Go
- Stars
- 2.5k
- Forks
- 74
- PR merge metrics
- No merged PRs in 30d
Description
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.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reading the leaf decoder mentioned in the issue and trace how standard-library errors transferred over the network are reconstructed. Check how context.Canceled and context.DeadlineExceeded are represented, then verify that decoding returns the standard-library instances so comparisons with == succeed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- distributed-systems
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100