-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(schema/testing): upgrade to go 1.23 iterators #21282
Conversation
WalkthroughWalkthroughThe primary changes in this update include upgrading the Go version across multiple workflow files and the Go module, which enhances the development environment with new features and improvements from Go 1.23. Additionally, significant refactoring was made in the Changes
Sequence Diagram(s)sequenceDiagram
participant A as Client
participant B as Workflow
participant C as Go Module
A->>B: Start Build Process
B->>C: Set Go Version 1.23
C->>B: Go Version Set
B->>A: Build Process Completed
sequenceDiagram
participant A as Client
participant B as State Comparison
participant C as Module States
participant D as Object Collections
A->>B: Initiate State Comparison
B->>C: Compare Expected Module States
C->>B: Return Results
B->>D: Compare Expected Object Collections
D->>B: Return Results
B->>A: Final Comparison Results
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
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 as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: .coderabbit.yml
Review profile: CHILL
Files selected for processing (6)
- .github/workflows/lint.yml (1 hunks)
- .github/workflows/test.yml (1 hunks)
- schema/testing/go.mod (1 hunks)
- schema/testing/statesim/app_diff.go (1 hunks)
- schema/testing/statesim/module_diff.go (1 hunks)
- schema/testing/statesim/object_coll_diff.go (3 hunks)
Files skipped from review due to trivial changes (1)
- schema/testing/go.mod
Additional context used
Path-based instructions (3)
schema/testing/statesim/app_diff.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.schema/testing/statesim/module_diff.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.schema/testing/statesim/object_coll_diff.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.
Additional comments not posted (7)
schema/testing/statesim/app_diff.go (2)
30-33
: Improved error handling in module iteration.The use of a
for
loop with error logging and continuation enhances the robustness of the function by ensuring all modules are processed, even if some errors occur. This approach improves maintainability and readability.
40-44
: Consistent error handling for missing modules.The consistent handling of errors and missing modules ensures that the function can continue processing and provide comprehensive error reporting.
.github/workflows/lint.yml (1)
21-21
: Upgrade to Go 1.23.The upgrade to Go 1.23 in the workflow file ensures that the latest features and improvements of the language are utilized. This change is consistent with the PR objectives.
schema/testing/statesim/module_diff.go (2)
30-33
: Improved error handling in object collection iteration.The use of a
for
loop with error logging and continuation enhances the robustness of the function by ensuring all object collections are processed, even if some errors occur. This approach improves maintainability and readability.
40-44
: Consistent error handling for missing object collections.The consistent handling of errors and missing object collections ensures that the function can continue processing and provide comprehensive error reporting.
schema/testing/statesim/object_coll_diff.go (1)
Line range hint
32-64
:
Refactoring improves readability and maintainability.The switch from a callback mechanism to a
for
loop withcontinue
statements simplifies the control flow and enhances readability. Ensure that this change aligns with the Uber Golang style guide, particularly regarding error handling and loop usage.Verification successful
Refactoring aligns with Go style practices.
The use of
continue
statements after error checks and specific conditions is consistent with Go's idiomatic style and the Uber Golang style guide. The error handling patternif err != nil
is appropriately used throughout the code.
- The code effectively manages control flow with
continue
after error checks.- Error handling is consistent and follows Go conventions.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify conformity with the Uber Golang style guide, focusing on error handling and loop usage. # Test: Check for style guide conformity. Expect: No style violations. golangci-lint run --enable=stylecheckLength of output: 120
Script:
#!/bin/bash # Check for the usage of `continue` within loops in the specified file. rg --context 3 'continue' schema/testing/statesim/object_coll_diff.go # Check for error handling patterns in the specified file. rg 'if err != nil' schema/testing/statesim/object_coll_diff.goLength of output: 905
.github/workflows/test.yml (1)
488-488
: Go version updated to 1.23.The update to Go 1.23 in the
test-schema-testing
job aligns with the PR objectives. Ensure consistency across all relevant jobs in the workflow.
Marking as R4R as linting works with go 1.23 now, but the linting errors are unrelated to the code in this PR. |
@julienrbrt noting that there's some overlap with this and #21280 |
Yes, let's merge your PR first, makes the diff there smaller. EDIT: I'm fixing linting there so we may need that one first actually. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: .coderabbit.yml
Review profile: CHILL
Files selected for processing (2)
- schema/testing/go.mod (1 hunks)
- scripts/build/linting.mk (1 hunks)
Files skipped from review due to trivial changes (1)
- scripts/build/linting.mk
Files skipped from review as they are similar to previous changes (1)
- schema/testing/go.mod
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Quality Gate passed for 'Cosmos SDK - Schema Testing'Issues Measures |
* main: (76 commits) docs: more app v2 renaming (#21336) chore: update link in disclaimer (#21339) refactor(x/distribution): audit QA (#21316) docs: rename app v2 to app di when talking about runtime v0 (#21329) feat(schema): specify JSON mapping (#21243) fix(x/authz): bring back msg response in `DispatchActions` (#21044) chore: fix all lint issue since golangci-lint bump (#21326) refactor(x/mint): v0.52 audit x/mint (#21301) chore: fix spelling errors (#21327) feat: export genesis in simapp v2 (#21199) fix(baseapp)!: Halt at height now does not produce the halt height block (#21256) refactor(scripts): remove unused variable (#21320) chore(schema/testing): upgrade to go 1.23 iterators (#21282) chore: readmes + upgrading docs (#21271) feat(client): add auto cli for node service (#21074) ci: fix github workflow vulnerable to script injection (#21304) build(deps): Bump github.com/prometheus/client_golang from 1.19.1 to 1.20.0 (#21307) build(deps): use Go 1.23 instead of Go 1.22 (#21280) refactor(x/auth): audit x/auth changes (#21146) chore: remove todo: "abstract out staking message back to staking" (#21266) ...
Description
This PR upgrades some of the code in schema/testing to use go 1.23 iterators, mainly to demonstrate the use of go 1.23 and these iterators. It also upgrades linting CI to support go 1.23.
The code was already prepared to use the iterator API, go 1.23 just wasn't stable yet so this is an easy refactor.
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
!
in the type prefix if API or client breaking changeCHANGELOG.md
Reviewers Checklist
All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.
Please see Pull Request Reviewer section in the contributing guide for more information on how to review a pull request.
I have...
Summary by CodeRabbit