mirror of
https://github.com/restic/restic.git
synced 2025-08-21 12:27:32 +00:00
error variable names should start with 'Err'
This commit is contained in:
@@ -10,15 +10,15 @@ import (
|
||||
"github.com/restic/restic/internal/restic"
|
||||
)
|
||||
|
||||
// SkipNode is returned by WalkFunc when a dir node should not be walked.
|
||||
var SkipNode = errors.New("skip this node")
|
||||
// ErrSkipNode is returned by WalkFunc when a dir node should not be walked.
|
||||
var ErrSkipNode = errors.New("skip this node")
|
||||
|
||||
// WalkFunc is the type of the function called for each node visited by Walk.
|
||||
// Path is the slash-separated path from the root node. If there was a problem
|
||||
// loading a node, err is set to a non-nil error. WalkFunc can chose to ignore
|
||||
// it by returning nil.
|
||||
//
|
||||
// When the special value SkipNode is returned and node is a dir node, it is
|
||||
// When the special value ErrSkipNode is returned and node is a dir node, it is
|
||||
// not walked. When the node is not a dir node, the remaining items in this
|
||||
// tree are skipped.
|
||||
//
|
||||
@@ -26,7 +26,7 @@ var SkipNode = errors.New("skip this node")
|
||||
// For tree nodes, this means that the function is not called for the
|
||||
// referenced tree. If the node is not a tree, and all nodes in the current
|
||||
// tree have ignore set to true, the current tree will not be visited again.
|
||||
// When err is not nil and different from SkipNode, the value returned for
|
||||
// When err is not nil and different from ErrSkipNode, the value returned for
|
||||
// ignore is ignored.
|
||||
type WalkFunc func(parentTreeID restic.ID, path string, node *restic.Node, nodeErr error) (ignore bool, err error)
|
||||
|
||||
@@ -38,7 +38,7 @@ func Walk(ctx context.Context, repo restic.TreeLoader, root restic.ID, ignoreTre
|
||||
_, err = walkFn(root, "/", nil, err)
|
||||
|
||||
if err != nil {
|
||||
if err == SkipNode {
|
||||
if err == ErrSkipNode {
|
||||
err = nil
|
||||
}
|
||||
return err
|
||||
@@ -76,7 +76,7 @@ func walk(ctx context.Context, repo restic.TreeLoader, prefix string, parentTree
|
||||
if node.Type != "dir" {
|
||||
ignore, err := walkFn(parentTreeID, p, node, nil)
|
||||
if err != nil {
|
||||
if err == SkipNode {
|
||||
if err == ErrSkipNode {
|
||||
// skip the remaining entries in this tree
|
||||
return allNodesIgnored, nil
|
||||
}
|
||||
@@ -102,7 +102,7 @@ func walk(ctx context.Context, repo restic.TreeLoader, prefix string, parentTree
|
||||
subtree, err := repo.LoadTree(ctx, *node.Subtree)
|
||||
ignore, err := walkFn(parentTreeID, p, node, err)
|
||||
if err != nil {
|
||||
if err == SkipNode {
|
||||
if err == ErrSkipNode {
|
||||
if ignore {
|
||||
ignoreTrees.Insert(*node.Subtree)
|
||||
}
|
||||
|
Reference in New Issue
Block a user