Skip to content

Commit 1abf6e7

Browse files
committed
CV fix lint
1 parent 7f2eda9 commit 1abf6e7

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

export.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ func newExporterWithOptions(tree *ImmutableTree, optimistic bool) (*Exporter, er
7878

7979
// export exports nodes
8080
func (e *Exporter) export(ctx context.Context) {
81-
e.tree.root.traversePost(e.tree, true, func(node *Node) bool {
81+
_ = e.tree.root.traversePost(e.tree, true, func(node *Node) bool {
8282
exportNode := &ExportNode{
8383
Key: node.key,
8484
Value: node.value,

import.go

+5-4
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,9 @@ func (i *Importer) OptimisticAdd(exportNode *ExportNode) error {
178178
}
179179
i.batchSize++
180180

181-
i.sendBatchIfFull()
181+
if err := i.sendBatchIfFull(); err != nil {
182+
return errors.New("failed sending db write batch")
183+
}
182184

183185
return nil
184186
}
@@ -263,9 +265,8 @@ func (i *Importer) Commit() error {
263265
return ErrNoImport
264266
}
265267

266-
if i.optimistic {
267-
// All keys should be already imported
268-
} else {
268+
// Optimistic: All keys should be already imported
269+
if !i.optimistic {
269270
switch len(i.stack) {
270271
case 0:
271272
if err := i.batch.Set(i.tree.ndb.nodeKey(GetRootKey(i.version)), []byte{}); err != nil {

node.go

+1
Original file line numberDiff line numberDiff line change
@@ -707,6 +707,7 @@ func (node *Node) calcBalance(t *ImmutableTree) (int, error) {
707707
}
708708

709709
// traverse is a wrapper over traverseInRange when we want the whole tree
710+
// nolint: unparam
710711
func (node *Node) traverse(t *ImmutableTree, ascending bool, cb func(*Node) bool) bool {
711712
return node.traverseInRange(t, nil, nil, ascending, false, false, func(node *Node) bool {
712713
return cb(node)

0 commit comments

Comments
 (0)