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

chore: fix a bunch of issues caught by golangci-lint #6140

Merged
merged 3 commits into from
Mar 29, 2019

Conversation

Stebalien
Copy link
Member

Most of these are probably harmless but a few looked like they might actually be bugs. Most of them are just faulty tests.

Why? Well, I thought "let me just try running this linter..." and then spent way more time than I should have on this.

@Stebalien Stebalien requested a review from Kubuxu as a code owner March 27, 2019 14:48
@ghost ghost assigned Stebalien Mar 27, 2019
@ghost ghost added the status/in-progress In progress label Mar 27, 2019
if err == nil {
err = adder.bufferedDS.Commit()
}
}()
Copy link
Member Author

Choose a reason for hiding this comment

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

Cause of #6139 (comment). We're ignoring the add error for small files.

Copy link

Choose a reason for hiding this comment

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

This will need a named err return value or something. Right now it references the first declared err and doesn't intercept any of the ones down below.

@Stebalien
Copy link
Member Author

I got an unrelated error that looks like a leveldb bug.

github.com/syndtr/goleveldb/leveldb.(*tOps).find(0xc00048c1e0, 0xc00043c190, 0xc000170280, 0x1c, 0x1c, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
	/home/circleci/go/pkg/mod/github.com/syndtr/[email protected]/leveldb/table.go:383 +0x221
github.com/syndtr/goleveldb/leveldb.(*version).get.func1(0x1, 0xc00043c190, 0x14)
	/home/circleci/go/pkg/mod/github.com/syndtr/[email protected]/leveldb/version.go:176 +0x452
github.com/syndtr/goleveldb/leveldb.(*version).walkOverlapping(0xc00043c1e0, 0x0, 0x0, 0x0, 0xc000170280, 0x1c, 0x1c, 0xc0001db910, 0xc0001db8e0)

	/home/circleci/go/pkg/mod/github.com/syndtr/[email protected]/leveldb/version.go:125 +0x477
github.com/syndtr/goleveldb/leveldb.(*version).get(0xc00043c1e0, 0x0, 0x0, 0x0, 0xc000170280, 0x1c, 0x1c, 0x0, 0x0, 0x0, ...)
	/home/circleci/go/pkg/mod/github.com/syndtr/[email protected]/leveldb/version.go:160 +0x2b2
github.com/syndtr/goleveldb/leveldb.(*DB).get(0xc00029e1a0, 0x0, 0x0, 0x0, 0x0, 0xc000170260, 0x14, 0x20, 0x141, 0x0, ...)
	/home/circleci/go/pkg/mod/github.com/syndtr/[email protected]/leveldb/db.go:779 +0x397
github.com/syndtr/goleveldb/leveldb.(*DB).Get(0xc00029e1a0, 0xc000170260, 0x14, 0x20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
	/home/circleci/go/pkg/mod/github.com/syndtr/[email protected]/leveldb/db.go:845 +0x12f
github.com/ipfs/go-ds-leveldb.(*accessor).Get(0xc00016a7b0, 0xc000170240, 0x14, 0x0, 0x0, 0x0, 0x0, 0x0)
	/home/circleci/go/pkg/mod/github.com/ipfs/[email protected]/datastore.go:84 +0x82
github.com/ipfs/go-ds-measure.(*measure).Get(0xc00010a480, 0xc000170240, 0x14, 0x0, 0x0, 0x0, 0x0, 0x0)
	/home/circleci/go/pkg/mod/github.com/ipfs/[email protected]/measure.go:149 +0xd4
github.com/ipfs/go-datastore/mount.(*Datastore).Get(0xc00000c400, 0xc000170080, 0x14, 0x24b0b20, 0xbf1f03a0296a5f36, 0x276c833, 0x2491a20, 0x14)
	/home/circleci/go/pkg/mod/github.com/ipfs/[email protected]/mount/mount.go:97 +0x70
github.com/ipfs/go-ds-measure.(*measure).Get(0xc00010a6c0, 0xc000170080, 0x14, 0x0, 0x0, 0x0, 0x0, 0x0)
	/home/circleci/go/pkg/mod/github.com/ipfs/[email protected]/measure.go:149 +0xd4
github.com/ipfs/go-datastore/keytransform.(*ktds).Get(0xc000244c00, 0xc000394090, 0x2, 0xd76a7c, 0x16af545, 0x1, 0xc000394090, 0x2)
	/home/circleci/go/pkg/mod/github.com/ipfs/[email protected]/keytransform/keytransform.go:40 +0x76
github.com/ipfs/go-ipfs/provider.(*Queue).nextEntry(0xc0003ace10, 0x0, 0x0, 0x1, 0x0)
	/home/circleci/ipfs/go-ipfs/provider/queue.go:73 +0xc2
github.com/ipfs/go-ipfs/provider.(*Queue).work.func1(0xc0003ace10)
	/home/circleci/ipfs/go-ipfs/provider/queue.go:107 +0x6d1
created by github.com/ipfs/go-ipfs/provider.(*Queue).work
	/home/circleci/ipfs/go-ipfs/provider/queue.go:101 +0x4f

@Kubuxu
Copy link
Member

Kubuxu commented Mar 27, 2019

Codeclimate has one more new issue for you.

Most of these are probably harmless but a few looked like they might actually be
bugs. Most of them are just faulty tests.

License: MIT
Signed-off-by: Steven Allen <[email protected]>
License: MIT
Signed-off-by: Steven Allen <[email protected]>
1. Yes, I like my symmetry.
2. No, we don't want to stash the private key if we fail to put it in the peerstore.

License: MIT
Signed-off-by: Steven Allen <[email protected]>
@Stebalien
Copy link
Member Author

I've moved the add fix to #6156 so we can merge it sooner.

@Stebalien
Copy link
Member Author

@Kubuxu can I get a signoff?

@Stebalien Stebalien merged commit fd15c62 into master Mar 29, 2019
@ghost ghost removed the status/in-progress In progress label Mar 29, 2019
@Stebalien Stebalien deleted the fix/golangci-lint branch March 29, 2019 13:09
hacdias pushed a commit to ipfs/boxo that referenced this pull request Jan 27, 2023
chore: fix a bunch of issues caught by golangci-lint

This commit was moved from ipfs/kubo@fd15c62
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.

3 participants