Skip to content

feat: add x/errgroup package with context-aware API - #8

Merged
min0625 merged 1 commit into
mainfrom
feat/add-x-errgroup-package-with-context-aware-api
Dec 11, 2025
Merged

min0625 merged 1 commit into
mainfrom
feat/add-x-errgroup-package-with-context-aware-api

Conversation

@min0625

@min0625 min0625 commented Dec 11, 2025

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings December 11, 2025 06:48
@min0625
min0625 merged commit 0e89c6d into main Dec 11, 2025
8 checks passed
@min0625
min0625 deleted the feat/add-x-errgroup-package-with-context-aware-api branch December 11, 2025 06:49

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a new x/errgroup package that wraps the existing panic-aware errgroup implementation with a context-aware API. The key enhancement is that the Go and TryGo methods now accept functions that receive a context.Context parameter, providing a more idiomatic Go concurrency pattern.

Key Changes:

  • Added context-aware Group API where goroutine functions receive context parameters
  • Implemented lazy initialization pattern using sync.Once for zero-value Group support
  • Provided comprehensive test coverage including panic handling scenarios

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
x/errgroup/errgroup.go Core implementation of the context-aware Group wrapper with lazy initialization
x/errgroup/panic.go Type aliases for PanicError and PanicValue from the underlying package
x/errgroup/errgroup_test.go Comprehensive test suite covering normal operation, errors, cancellation, and panic scenarios
x/errgroup/example_test.go Example demonstrating panic recovery behavior with the new API
panic.go Added package documentation comment

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

})

require.ErrorIs(t, g.Wait(), myErr)
assert.True(t, jobIsCanceled, true)

Copilot AI Dec 11, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The second argument to assert.True should be a message string, not a boolean value. This will cause the test to fail compilation or produce incorrect behavior.

Suggested change
assert.True(t, jobIsCanceled, true)
assert.True(t, jobIsCanceled)

Copilot uses AI. Check for mistakes.
})

require.ErrorIs(t, g.Wait(), myErr)
assert.True(t, jobIsCanceled, true)

Copilot AI Dec 11, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The second argument to assert.True should be a message string, not a boolean value. This will cause the test to fail compilation or produce incorrect behavior.

Suggested change
assert.True(t, jobIsCanceled, true)
assert.True(t, jobIsCanceled, "job should be canceled")

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants