1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-08-06 11:31:54 +08:00

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

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 <steven@stebalien.com>
This commit is contained in:
Steven Allen
2019-03-27 14:46:29 +00:00
parent aedb722a2c
commit 1f293eff1b
49 changed files with 244 additions and 195 deletions

View File

@ -72,7 +72,7 @@ func TestAddGCLive(t *testing.T) {
_, err := adder.AddAllAndPin(slf)
if err != nil {
t.Fatal(err)
t.Error(err)
}
}()
@ -93,7 +93,9 @@ func TestAddGCLive(t *testing.T) {
}()
// gc shouldnt start until we let the add finish its current file.
pipew.Write([]byte("some data for file b"))
if _, err := pipew.Write([]byte("some data for file b")); err != nil {
t.Fatal(err)
}
select {
case <-gcstarted:
@ -178,7 +180,7 @@ func testAddWPosInfo(t *testing.T, rawLeaves bool) {
defer close(adder.Out)
_, err = adder.AddAllAndPin(file)
if err != nil {
t.Fatal(err)
t.Error(err)
}
}()
for range out {
@ -227,7 +229,7 @@ func (bs *testBlockstore) PutMany(blocks []blocks.Block) error {
return bs.GCBlockstore.PutMany(blocks)
}
func (bs *testBlockstore) CheckForPosInfo(block blocks.Block) error {
func (bs *testBlockstore) CheckForPosInfo(block blocks.Block) {
fsn, ok := block.(*pi.FilestoreNode)
if ok {
posInfo := fsn.PosInfo
@ -240,7 +242,6 @@ func (bs *testBlockstore) CheckForPosInfo(block blocks.Block) error {
bs.countAtOffsetNonZero += 1
}
}
return nil
}
type dummyFileInfo struct {