Repository navigation
chore: Better abstraction - #1
Conversation
There was a problem hiding this comment.
Code Review
This pull request implements widespread formatting updates across the arr, collection, and kv packages, primarily adding vertical whitespace to improve the readability of logic blocks and test cases. Additionally, it introduces a new go-fmt.compose.yaml file to facilitate the use of the go-fmt tool via Docker Compose. I have no feedback to provide.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f7c3c3953e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| // Combine pairs of keys from this collection with values from the given slice, | ||
| // returning a collection of Pair values. | ||
| func Combine[K any, V any](keys *Collection[K], values []V) *Collection[support.Pair[K, V]] { |
There was a problem hiding this comment.
Preserve collection.Pair compatibility in Combine
Combine now returns *Collection[support.Pair[K, V]], but the collection.Pair type that callers previously depended on is no longer exposed in this package. Any downstream code with APIs or type assertions built around collection.Pair will fail to compile after this upgrade even though the logical behavior of Combine is unchanged. Please keep a compatibility alias in collection (for example type Pair = support.Pair) so existing consumers can upgrade without breaking.
Useful? React with 👍 / 👎.
| if !ok { | ||
| var zero T | ||
|
|
||
| return zero, &support.ItemNotFoundError{} |
There was a problem hiding this comment.
Keep collection error types available to callers
FirstOrFail (and similarly Sole) now returns support.* error types, while collection.ItemNotFoundError/collection.MultipleItemsFoundError are no longer available from the original package. This is a breaking change for callers that match these concrete error types (for example with errors.As) or reference them directly, and it will surface as downstream compile/runtime compatibility breakage. Please re-export aliases from collection to preserve existing error contracts.
Useful? React with 👍 / 👎.
| // PairIter returns an iter.Seq2[int, T] that yields each index-item pair in the collection. | ||
| func (c *Collection[T]) PairIter() iter.Seq2[int, T] { |
There was a problem hiding this comment.
Restore Iter2 alias for backward compatibility
The indexed iterator method was renamed to PairIter, but the previously exported Iter2 method was removed. Existing clients using c.Iter2() will fail to compile after upgrading, even though the underlying behavior is identical. Keeping a deprecated Iter2 wrapper that forwards to PairIter would avoid this unnecessary API break.
Useful? React with 👍 / 👎.
No description provided.