Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Commit

Permalink
linting
Browse files Browse the repository at this point in the history
  • Loading branch information
gaissmai committed Apr 4, 2021
1 parent 0f68a4b commit 148f5e8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion inettree/augmentInetBlock.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func (a Item) Less(i tree.Interface) bool {
return a.Block.Less(b.Block)
}

// Equal implements the tree.Interface for Item
// Equals implements the tree.Interface for Item
func (a Item) Equals(i tree.Interface) bool {
b := i.(Item)
return a.Block == b.Block
Expand Down
12 changes: 7 additions & 5 deletions tree/tree.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,10 @@ func (t *Tree) walkAndStringify(p int, buf *strings.Builder, pad string) *string
// If the function returns a non-nil error, Walk stops and returns that error.
type WalkFunc func(depth int, item, parent Interface, childs []Interface) error

// String returns the ordered tree as a directory graph.
// The items are stringified using their fmt.Stringer interface.
// Walk walks the tree, calling fn for each item in the tree.
//
// The items are walked in natural pre-order, as presented by String().
// Every error returned by fn stops the walk and is returned to the caller.
func (t *Tree) Walk(fn WalkFunc) error {
if t == nil {
return nil
Expand All @@ -241,8 +243,8 @@ func (t *Tree) walk(fn WalkFunc, d, idx, p int) error {
parent = t.items[p]
}

c_idxs := t.tree[idx]
for _, c := range c_idxs {
cs := t.tree[idx]
for _, c := range cs {
childs = append(childs, t.items[c])
}

Expand All @@ -252,7 +254,7 @@ func (t *Tree) walk(fn WalkFunc, d, idx, p int) error {
}

// rec-descent
for _, c := range c_idxs {
for _, c := range cs {
if err := t.walk(fn, d+1, c, idx); err != nil {
return err
}
Expand Down

0 comments on commit 148f5e8

Please sign in to comment.