Skip to content
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

go: Fix more linter problems #228

Merged
merged 8 commits into from
Jun 20, 2024

Conversation

2opremio
Copy link
Contributor

No description provided.

Comment on lines -254 to +264
reader.Seek(txIndex - 1)
if err != nil {
return lcm, ingest.LedgerTransaction{},
errors.Wrapf(err, "failed to index to tx %d in ledger %d (txhash=%s)",
txIndex, lcm.LedgerSequence(), hash)
fmt.Errorf("failed to create ledger reader: %w", err)
}
err = reader.Seek(txIndex - 1)
if err != nil {
return lcm, ingest.LedgerTransaction{},
fmt.Errorf("failed to index to tx %d in ledger %d (txhash=%s): %w",
txIndex, lcm.LedgerSequence(), hash, err)
Copy link
Contributor Author

@2opremio 2opremio Jun 20, 2024

Choose a reason for hiding this comment

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

This one was ugly (the seek error wasn't checked)

@2opremio 2opremio force-pushed the fix-more-linter-problems branch 2 times, most recently from 78c719e to f66c6d2 Compare June 20, 2024 14:46
@@ -239,7 +243,7 @@ func TestGetTransactions_LedgerNotFound(t *testing.T) {
}

response, err := handler.getTransactionsByLedgerSequence(context.TODO(), request)
expectedErr := errors.Errorf("[%d] ledger close meta not found: 2", jrpc2.InvalidParams)
expectedErr := fmt.Errorf("[%d] ledger close meta not found: 2", jrpc2.InvalidParams)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why moving from errors package to fmt?

Copy link
Contributor Author

@2opremio 2opremio Jun 20, 2024

Choose a reason for hiding this comment

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

Because our internal errors package uses an outdated implementation of error wrapping https://github.com/pkg/errors (which only made sense when the std library didn't implement it)

The std library now provides "errors" and fmt.Errorf()

Copy link
Contributor Author

@2opremio 2opremio Jun 20, 2024

Choose a reason for hiding this comment

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

We should remove the package from stellar/go

CC @tamirms @mollykarcher

Copy link
Contributor

@psheth9 psheth9 left a comment

Choose a reason for hiding this comment

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

Looks good !!

@2opremio 2opremio merged commit 6b0e715 into stellar:main Jun 20, 2024
19 checks passed
@2opremio 2opremio deleted the fix-more-linter-problems branch June 20, 2024 16:43
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.

None yet

2 participants