Skip to content

Commit

Permalink
shed: fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
magik6k committed Mar 9, 2022
1 parent 84dbb22 commit ffabb01
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 15 deletions.
14 changes: 3 additions & 11 deletions cmd/lotus-shed/datastore-vlog.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions cmd/lotus-shed/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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")

Expand Down Expand Up @@ -332,7 +332,7 @@ var exportRawCmd = &cli.Command{
},
}

var fullCar = errors.New("full")
var errFullCar = errors.New("full")

const maxlinks = 16

Expand Down Expand Up @@ -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()))
Expand Down

0 comments on commit ffabb01

Please sign in to comment.