Skip to content

refactor: use reflect.TypeFor#4540

Open
slightsharp wants to merge 1 commit intozeta-chain:developfrom
slightsharp:develop
Open

refactor: use reflect.TypeFor#4540
slightsharp wants to merge 1 commit intozeta-chain:developfrom
slightsharp:develop

Conversation

@slightsharp
Copy link

@slightsharp slightsharp commented Feb 4, 2026

Description

Try to use better api reflect.TypeFor instead of reflect.TypeOf when we have known the type.
More info golang/go#60088

How Has This Been Tested?

  • Tested CCTX in localnet
  • Tested in development environment
  • Go unit tests
  • Go integration tests
  • Tested via GitHub Actions

Summary by CodeRabbit

  • Refactor
    • Updated internal type reflection mechanisms across test and utility modules for improved code maintainability.

Signed-off-by: slightsharp <slightsharp@outlook.com>
@slightsharp slightsharp requested a review from a team as a code owner February 4, 2026 17:14
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 4, 2026

📝 Walkthrough

Walkthrough

This pull request modernizes type reflection across the codebase by replacing reflect.TypeOf() calls with the newer reflect.TypeFor[]() generic-based API, affecting configuration tests and utility nullification logic without altering control flow or functionality.

Changes

Cohort / File(s) Summary
Type Reflection Modernization - Config
e2e/config/config_test.go
Replaced reflect.TypeOf(AdditionalAccounts{}) with reflect.TypeFor[AdditionalAccounts]() to modernize type retrieval using Go generics.
Type Reflection Modernization - Nullify
testutil/nullify/nullify.go
Updated three package-scope type descriptor initializations (coinType, coinsType, uintType) from reflect.TypeOf() to reflect.TypeFor[]() API calls.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'refactor: use reflect.TypeFor' accurately summarizes the primary change, clearly identifying the refactoring effort to adopt the newer reflect.TypeFor API.
Description check ✅ Passed The description includes the required Description and How Has This Been Tested sections with appropriate detail and context. One testing option is marked as completed.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

4 participants