core icon indicating copy to clipboard operation
core copied to clipboard

Add thread-safe multi error implementation

Open matej-g opened this issue 3 years ago • 1 comments

This is directly inspired by @fpetkovski's work in https://github.com/thanos-io/thanos/pull/5420#discussion_r897531384.

This PR adds a thread-safe implementation of the NilOrMultiError called NilOrMultiSyncError. PR provides tests as well.

Another small fix in this PR is to unify the method receivers NilOrMultiError to use pointers.

matej-g avatar Oct 07 '22 13:10 matej-g

I would vote for having just concurrency safe code for merrors. The reason is that soon (Go 1.20) we will likely have errors.Join in standard library, so simple cases will be solved. I don't see a huge overhead of doing concurrency control in seq code when it comes to error handling, but I might underestimate it (:

I would do it (: cc @saswatamcode @matej-g

bwplotka avatar Nov 30 '22 09:11 bwplotka