Skip to content

fix staticcheck errors#67

Merged
marten-seemann merged 1 commit into
ipld:masterfrom
marten-seemann:fix-staticcheck
Apr 1, 2021
Merged

fix staticcheck errors#67
marten-seemann merged 1 commit into
ipld:masterfrom
marten-seemann:fix-staticcheck

Conversation

@marten-seemann

Copy link
Copy Markdown
Contributor

No description provided.

@marten-seemann marten-seemann requested a review from mvdan April 1, 2021 09:17
Comment thread car.go
var buf []blocks.Block
for {
blk, err := cr.Next()
switch err {

Copy link
Copy Markdown
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
Copy Markdown
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.

Comment thread car.go
var buf []blocks.Block
for {
blk, err := cr.Next()
switch err {

Copy link
Copy Markdown
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