Skip to content

refactor: replace context.WithCancel with t.Context#11083

Merged
lidel merged 1 commit into
ipfs:masterfrom
rifeplight:master
Nov 28, 2025
Merged

refactor: replace context.WithCancel with t.Context#11083
lidel merged 1 commit into
ipfs:masterfrom
rifeplight:master

Conversation

@rifeplight

Copy link
Copy Markdown
Contributor

The addition of the Context method to Go's testing.T provides significant improvements for writing concurrent tests. It allows better management of goroutines, ensuring they properly exit and preventing issues like deadlocks and unfinished processes.

By using Context, errors and cancellations can be handled more effectively, making tests more robust and easier to reason about. This change also enables tighter integration between tests and the application code, especially for systems that span multiple concurrent components. Overall, it simplifies test code and enhances test stability and maintainability.

More info: golang/go#18368

Signed-off-by: rifeplight <rifeplight@outlook.com>
@rifeplight rifeplight requested a review from a team as a code owner November 28, 2025 08:13
@lidel lidel added the skip/changelog This change does NOT require a changelog entry label Nov 28, 2025

@lidel lidel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you!

@lidel lidel merged commit 3f2cc50 into ipfs:master Nov 28, 2025
20 of 21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip/changelog This change does NOT require a changelog entry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants