shed: fix lint

This commit is contained in:
Łukasz Magiera 2022-03-09 10:26:02 +01:00
parent 84dbb229b6
commit ffabb015ef
2 changed files with 7 additions and 15 deletions

View File

@ -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

View File

@ -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()))