-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
refactor: add close body after use and fix lint #22248
Merged
Merged
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
89506df
refactor: add close body after used and fix lint
hoank101 8df8a64
Merge branch 'main' into hoa/fix-lint
hoank101 dbe05c5
bet
hoank101 5f13f8b
Merge remote-tracking branch 'origin/hoa/fix-lint' into hoa/fix-lint
hoank101 74caa39
Merge branch 'main' of github.com:cosmos/cosmos-sdk into hoa/fix-lint
hoank101 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
💡 Codebase verification
Ensure consistent error wrapping by using
%w
in allfmt.Errorf
callsThe following
fmt.Errorf
instances inschema/indexer/start.go
do not use the%w
verb and should be updated to enhance error handling consistency:return IndexingTarget{}, fmt.Errorf("indexer type %q not found", targetCfg.Type)
return IndexingTarget{}, fmt.Errorf("indexer filter options are not supported yet")
return nil, fmt.Errorf("can't convert %T to %T", cfg, IndexingConfig{})
Recommended Action:
Update these instances to utilize the
%w
verb for error wrapping, ensuring that the original error is preserved and can be unwrapped later. For example:This change aligns with Go's error handling best practices and improves the ability to trace error chains.
🔗 Analysis chain
Improved error wrapping using
%w
verbThe change from
%v
to%w
in the error formatting is a good improvement. This modification allows for better error handling and debugging capabilities.Reasons for approval:
%w
verb wraps the original error, preserving the error chain.Suggestion for further improvement:
Consider updating other error handling instances in this file to use
%w
where appropriate, for consistency. This would involve checking otherfmt.Errorf
calls within theStartIndexing
function and potentially other functions in this file.To ensure consistency across the file, let's check for other instances of error formatting:
This will help identify if there are other error formatting calls that might benefit from using
%w
.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
Length of output: 411