Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Concurrent functions return multiple errors.
These are now returned only as either a channel or a slice.
This avoids a dependency on a 3rd party multi errors library. The standard library errors.Join is awkward to use because there is not a simple way to unwrap the errors.
We could use a custom multi error.
However, to make this convenient to use it should be returned as a pointer to the struct rather than an opaque error. But Go has a subtle design issue where
an interface can end up being non-nil when storing a pointer to a struct.
Returning []error still allows the caller to use errors.Join() if they don't care about iterating the individual errors.
The main issue is that someone may check != nil rather than len > 0 However, all the APIs are designed to return nil rather than a zero length slice.
Additionally, don't use the default recovery handler. Write more errors to the error channels.
Panic a few errors that shouldn't happen.