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

fix staticcheck errors #67

Merged
merged 1 commit into from
Apr 1, 2021

Conversation

marten-seemann
Copy link
Contributor

No description provided.

@@ -183,17 +183,16 @@ func loadCarFast(s batchStore, cr *CarReader) (*CarHeader, error) {
var buf []blocks.Block
for {
blk, err := cr.Next()
switch err {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure if there was a reason to use a switch here. Performance maybe, since this is a function that's supposedly "fast"?
If I remember correctly though, switch is not faster than if / else, unless you have a lot of cases.

Copy link
Contributor

Choose a reason for hiding this comment

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

I honestly don't think it matters here, either.

For those reading this later, the warning is:

default case should be first or last in switch statement (ST1015)

It's entirely reasonable. I also think the if/else method is simpler.

@@ -183,17 +183,16 @@ func loadCarFast(s batchStore, cr *CarReader) (*CarHeader, error) {
var buf []blocks.Block
for {
blk, err := cr.Next()
switch err {
Copy link
Contributor

Choose a reason for hiding this comment

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

I honestly don't think it matters here, either.

For those reading this later, the warning is:

default case should be first or last in switch statement (ST1015)

It's entirely reasonable. I also think the if/else method is simpler.

@marten-seemann marten-seemann merged commit 5da23b6 into ipld:master Apr 1, 2021
@aschmahmann aschmahmann mentioned this pull request May 14, 2021
71 tasks
Jorropo pushed a commit to ipfs/boxo that referenced this pull request Mar 22, 2023
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.

2 participants