From ffabb015ef8b2a79504d2138ecb7f337aae7efa2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Wed, 9 Mar 2022 10:26:02 +0100 Subject: [PATCH] shed: fix lint --- cmd/lotus-shed/datastore-vlog.go | 14 +++----------- cmd/lotus-shed/export.go | 8 ++++---- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/cmd/lotus-shed/datastore-vlog.go b/cmd/lotus-shed/datastore-vlog.go index 4a848b24f..7f0c708a5 100644 --- a/cmd/lotus-shed/datastore-vlog.go +++ b/cmd/lotus-shed/datastore-vlog.go @@ -117,7 +117,7 @@ var datastoreVlog2CarCmd = &cli.Command{ err = carb.consume(c, b) switch err { case nil: - case fullCar: + case errFullCar: root, err := carb.finalize() if err != nil { return xerrors.Errorf("carb finalize: %w", err) @@ -217,12 +217,10 @@ type Entry struct { UserMeta byte ExpiresAt uint64 // time.Unix meta byte - version uint64 // Fields maintained internally. - offset uint32 - skipVlog bool - hlen int // Length of the header. + offset uint32 + hlen int // Length of the header. } // Entry reads an entry from the provided reader. It also validates the checksum for every entry @@ -284,12 +282,6 @@ type header struct { userMeta byte } -const ( - // Maximum possible size of the header. The maximum size of header struct will be 18 but the - // maximum size of varint encoded header will be 21. - maxHeaderSize = 21 -) - // Encode encodes the header into []byte. The provided []byte should be atleast 5 bytes. The // function will panic if out []byte isn't large enough to hold all the values. // The encoded header looks like diff --git a/cmd/lotus-shed/export.go b/cmd/lotus-shed/export.go index 9583c0ac5..fec4d575a 100644 --- a/cmd/lotus-shed/export.go +++ b/cmd/lotus-shed/export.go @@ -215,7 +215,7 @@ var exportRawCmd = &cli.Command{ err = carb.consume(c, b) switch err { case nil: - case fullCar: + case errFullCar: root, err := carb.finalize() if err != nil { return xerrors.Errorf("carb finalize: %w", err) @@ -263,7 +263,7 @@ var exportRawCmd = &cli.Command{ if err != nil { return fmt.Errorf("failed to open badger blockstore: %w", err) } - defer db.Close() + defer db.Close() // nolint:errcheck log.Infow("new stream") @@ -332,7 +332,7 @@ var exportRawCmd = &cli.Command{ }, } -var fullCar = errors.New("full") +var errFullCar = errors.New("full") const maxlinks = 16 @@ -418,7 +418,7 @@ func (rc *rawCarb) consume(c cid.Cid, b block.Block) error { return err } if rc.cur+uint64(len(b.RawData())) > rc.max { - return fullCar + return errFullCar } rc.cur += uint64(len(b.RawData()))