🐛 Add missing Context() and SetContext() methods to Ctx interface#3626
🐛 Add missing Context() and SetContext() methods to Ctx interface#3626Copilot wants to merge 3 commits into
Conversation
- Add Context() method that returns the DefaultCtx itself since it implements context.Context - Add SetContext() method for setting context values (equivalent to Locals) - Regenerate interface using ifacemaker - Add comprehensive tests for both methods - Verify that Ctx can be passed as context.Context to other functions Co-authored-by: ReneWerner87 <7063188+ReneWerner87@users.noreply.github.com>
|
@copilot I think it was just important that the documentation be adapted |
Co-authored-by: ReneWerner87 <7063188+ReneWerner87@users.noreply.github.com>
You're absolutely right. I've fixed the documentation instead of adding the methods. The issue was contradictory documentation - it stated that Since Fixed in commit 179c9e2. Warning Firewall rules blocked me from connecting to one or more addressesI tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Join our Discord community for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
closed by #3650 |
The v3 documentation states that
UserContextwas renamed toContext()which should return acontext.Contextobject, andSetUserContextwas renamed toSetContext(). However, these methods were missing from the Ctx interface in v3.0.0-beta.5.While
DefaultCtxalready implementscontext.Contextdirectly (which is cleaner), users following the migration guide expect these methods to exist as documented.Changes
Added
Context()method:DefaultCtxitself since it already implementscontext.Contextc.Context()as documented in the migration guideCtxdirectly ascontext.ContextAdded
SetContext()method:Locals()but matches the context API namingValue()Example usage:
Testing
Ctxcan be passed ascontext.Contextto other functionsFixes #3624.
Warning
Firewall rules blocked me from connecting to one or more addresses
I tried to connect to the following addresses, but was blocked by firewall rules:
exampleretry.com/tmp/go-build2872156064/b273/client.test -test.paniconexit0 -test.v=test2json -test.timeout=10m0s -test.count=1 -test.shuffle=on(dns block)/tmp/go-build160186565/b273/client.test -test.paniconexit0 -test.v=test2json -test.timeout=10m0s -test.count=1 -test.shuffle=on(dns block)If you need me to access, download, or install something from one of these locations, you can either:
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.