fix tests/lint

This commit is contained in:
Łukasz Magiera 2023-05-23 11:59:40 +02:00
parent 587c3fde58
commit 6c62e6d8e2
8 changed files with 13 additions and 12 deletions

View File

@ -653,7 +653,7 @@ fr32 padding is removed from the output.`,
return xerrors.Errorf("getting reader: %w", err) return xerrors.Errorf("getting reader: %w", err)
} }
rd, err := readStarter(0) rd, err := readStarter(0, storiface.PaddedByteIndex(length))
if err != nil { if err != nil {
return xerrors.Errorf("starting reader: %w", err) return xerrors.Errorf("starting reader: %w", err)
} }

View File

@ -207,8 +207,8 @@ func TestRemoteGetAllocated(t *testing.T) {
pfhandler := mocks.NewMockPartialFileHandler(mockCtrl) pfhandler := mocks.NewMockPartialFileHandler(mockCtrl)
handler := &paths.FetchHandler{ handler := &paths.FetchHandler{
lstore, Local: lstore,
pfhandler, PfHandler: pfhandler,
} }
// run http server // run http server

View File

@ -2,9 +2,10 @@ package paths
import ( import (
"context" "context"
"github.com/filecoin-project/go-state-types/abi"
"io" "io"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/lotus/storage/sealer/fsutil" "github.com/filecoin-project/lotus/storage/sealer/fsutil"
"github.com/filecoin-project/lotus/storage/sealer/partialfile" "github.com/filecoin-project/lotus/storage/sealer/partialfile"
"github.com/filecoin-project/lotus/storage/sealer/storiface" "github.com/filecoin-project/lotus/storage/sealer/storiface"

View File

@ -5,7 +5,7 @@
package mocks package mocks
import ( import (
os "os" io "io"
reflect "reflect" reflect "reflect"
gomock "github.com/golang/mock/gomock" gomock "github.com/golang/mock/gomock"
@ -84,10 +84,10 @@ func (mr *MockPartialFileHandlerMockRecorder) OpenPartialFile(arg0, arg1 interfa
} }
// Reader mocks base method. // Reader mocks base method.
func (m *MockPartialFileHandler) Reader(arg0 *partialfile.PartialFile, arg1 storiface.PaddedByteIndex, arg2 abi.PaddedPieceSize) (*os.File, error) { func (m *MockPartialFileHandler) Reader(arg0 *partialfile.PartialFile, arg1 storiface.PaddedByteIndex, arg2 abi.PaddedPieceSize) (io.Reader, error) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Reader", arg0, arg1, arg2) ret := m.ctrl.Call(m, "Reader", arg0, arg1, arg2)
ret0, _ := ret[0].(*os.File) ret0, _ := ret[0].(io.Reader)
ret1, _ := ret[1].(error) ret1, _ := ret[1].(error)
return ret0, ret1 return ret0, ret1
} }

View File

@ -477,7 +477,7 @@ func TestReader(t *testing.T) {
require.Nil(t, rdg) require.Nil(t, rdg)
require.Contains(t, err.Error(), tc.errStr) require.Contains(t, err.Error(), tc.errStr)
} else { } else {
rd, err = rdg(0) rd, err = rdg(0, storiface.PaddedByteIndex(size))
require.Error(t, err) require.Error(t, err)
require.Nil(t, rd) require.Nil(t, rd)
require.Contains(t, err.Error(), tc.errStr) require.Contains(t, err.Error(), tc.errStr)
@ -490,7 +490,7 @@ func TestReader(t *testing.T) {
require.Nil(t, rd) require.Nil(t, rd)
} else { } else {
require.NotNil(t, rdg) require.NotNil(t, rdg)
rd, err := rdg(0) rd, err := rdg(0, storiface.PaddedByteIndex(size))
require.NoError(t, err) require.NoError(t, err)
defer func() { defer func() {

View File

@ -2,7 +2,6 @@ package partialfile
import ( import (
"encoding/binary" "encoding/binary"
"github.com/filecoin-project/lotus/lib/readerutil"
"io" "io"
"os" "os"
"syscall" "syscall"
@ -14,6 +13,7 @@ import (
rlepluslazy "github.com/filecoin-project/go-bitfield/rle" rlepluslazy "github.com/filecoin-project/go-bitfield/rle"
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/lotus/lib/readerutil"
"github.com/filecoin-project/lotus/storage/sealer/fsutil" "github.com/filecoin-project/lotus/storage/sealer/fsutil"
"github.com/filecoin-project/lotus/storage/sealer/storiface" "github.com/filecoin-project/lotus/storage/sealer/storiface"
) )

View File

@ -3,10 +3,10 @@ package sealer
import ( import (
"bufio" "bufio"
"context" "context"
pool "github.com/libp2p/go-buffer-pool"
"io" "io"
"github.com/ipfs/go-cid" "github.com/ipfs/go-cid"
pool "github.com/libp2p/go-buffer-pool"
"golang.org/x/xerrors" "golang.org/x/xerrors"
"github.com/filecoin-project/dagstore/mount" "github.com/filecoin-project/dagstore/mount"

View File

@ -6,13 +6,13 @@ import (
"io" "io"
"sync" "sync"
lru "github.com/hashicorp/golang-lru/v2"
"github.com/ipfs/go-cid" "github.com/ipfs/go-cid"
"go.opencensus.io/stats" "go.opencensus.io/stats"
"golang.org/x/xerrors" "golang.org/x/xerrors"
"github.com/filecoin-project/dagstore/mount" "github.com/filecoin-project/dagstore/mount"
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
lru "github.com/hashicorp/golang-lru/v2"
"github.com/filecoin-project/lotus/metrics" "github.com/filecoin-project/lotus/metrics"
) )